Skip to content

Syntax highlighting broken for code blocks created with triple backticks #1996

@ysds

Description

@ysds

Describe the bug
When inserting a code block using triple backticks (```), syntax highlighting doesn't work based on the defaultLanguage setting.

Image

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://www.blocknotejs.org/examples/theming/code-block
  2. Type ``` to create a code block
  3. Enter const x = 3 * 4;
  4. Syntax highlighting doesn't work (even though JavaScript is selected in the dropdown)
  5. Select a different language, and syntax highlighting starts working

Expected behavior

  • Syntax highlighting should work based on the defaultLanguage setting

However, it works correctly when inserting code blocks through the Suggestion Menu or when pasting markdown that contains code blocks with language specification.

Misc

  • Node version:
  • Package manager:
  • Browser: Chrome 140.0.7339.133
  • I'm a sponsor and would appreciate if you could look into this sooner than later 💖

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions