Is there an existing issue for this?
Summary
In the Community Edition editor, a code block's language can only be set at creation time via the ```lang input rule. There is no UI to view or change it afterwards:
- Code blocks inserted via the slash command, the bubble menu, paste, or markdown import are created with
language: null, so they get no syntax highlighting.
- The only way to fix a wrong or missing language is to delete the block and retype the fence from scratch.
- Read-only surfaces (pages, comments) have no way to tell which language a block was intended to use.
(#9680 references a language dropdown with a search input, but that exists only in the cloud/commercial build — CE master has no language selector at all, only the copy button in code-block-node-view.tsx.)
Proposed behavior
Add a compact language dropdown to the code block node view (top-left, editable mode only):
- Lists every grammar registered in the extension's lowlight instance, plus a "Plain text" (null) option.
- Selecting a language writes through to the node's
language attribute, so lowlight highlighting updates immediately.
- An explicitly set but unregistered language stays selectable instead of blanking the picker.
I have a working implementation and would like to raise a PR if the team is interested.
Why should this be worked on?
Syntax highlighting is one of the main reasons to use code blocks, and today a large share of blocks (anything not created by typing the fence manually) silently end up unhighlighted with no recourse. A selector makes the existing lowlight integration actually reachable and matches the UX of the cloud version.
Is there an existing issue for this?
Summary
In the Community Edition editor, a code block's language can only be set at creation time via the
```langinput rule. There is no UI to view or change it afterwards:language: null, so they get no syntax highlighting.(#9680 references a language dropdown with a search input, but that exists only in the cloud/commercial build — CE
masterhas no language selector at all, only the copy button incode-block-node-view.tsx.)Proposed behavior
Add a compact language dropdown to the code block node view (top-left, editable mode only):
languageattribute, so lowlight highlighting updates immediately.I have a working implementation and would like to raise a PR if the team is interested.
Why should this be worked on?
Syntax highlighting is one of the main reasons to use code blocks, and today a large share of blocks (anything not created by typing the fence manually) silently end up unhighlighted with no recourse. A selector makes the existing lowlight integration actually reachable and matches the UX of the cloud version.