You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Typing ``` then Enter throws "Language is not supported" and corrupts cursor/deletion #3005
Typing ``` (with no language name) and pressing Enter creates a code block whose language is an empty string. The highlighter then throws Uncaught Error: Language is not supported. After that, the cursor position is wrong, and Backspace/Delete no longer behave correctly in that block.
What did you expect to happen?
Typing ``` and pressing Enter should create a normal code block with the default language (e.g. text), without throwing. The cursor should land inside the block, and Backspace/Delete should work as usual.
In an empty paragraph, type ``` (three backticks, no language name).
Press Enter.
Result: the console throws Uncaught Error: Language is not supported. After that, the cursor is in the wrong place, and Backspace/Delete in that block are also wrong.
```js then Enter does not reproduce this.
BlockNote version
v0.54.0
Environment
No response
Additional context
No response
Contribution
I'd be interested in contributing a fix for this issue
Sponsor
I'm a sponsor and would appreciate if you could look into this sooner than later 💖
Root cause is in the code-block input rule (CodeKeyboardShortcutsExtension.ts):
find: /^```(.*?)\s$/,replace: ({ match })=>{constlanguageName=match[1].trim();constattributes={language: getLanguageId(options,languageName)??languageName,};
With no language suffix, match[1] is empty, getLanguageId returns undefined, and the raw empty string is used as the language. createLanguageSelect then throws because "" isn't in supportedLanguages — hence the double space in Language is not supported. — and the block is left in a broken state, which is what breaks the cursor and Backspace/Delete afterwards.
Fix is to fall back to the configured defaultLanguage ("text") when no language is given. Note there are two existing tests asserting the empty-language behaviour, so those encode the bug and will be updated. PR shortly.
Activity
adarshsm commentedon Aug 29, 2026
Taking this one.
Root cause is in the code-block input rule (
CodeKeyboardShortcutsExtension.ts):With no language suffix,
match[1]is empty,getLanguageIdreturns undefined, and the raw empty string is used as the language.createLanguageSelectthen throws because""isn't insupportedLanguages— hence the double space inLanguage is not supported.— and the block is left in a broken state, which is what breaks the cursor and Backspace/Delete afterwards.Fix is to fall back to the configured
defaultLanguage("text") when no language is given. Note there are two existing tests asserting the empty-language behaviour, so those encode the bug and will be updated. PR shortly.AntoLC commentedon Sep 3, 2026
Hi !
In our case, we used an alias
js, it should be supported:BlockNote/packages/core/src/blocks/Code/CodeBlockOptions.ts
Lines 37 to 48 in 63c2389
But it throws an error, the alias does not seem checked.
BlockNote/packages/core/src/blocks/Code/helpers/render/createCodeBlock.ts
Lines 16 to 18 in 63c2389
In this case, using a fallback language could maybe provide a smoother user experience than throwing an error, wdyt ?