Code Block Highlight not working (Invalid syntax highlight definitions: define at least one highlight.js language mapping)
See original GitHub issueProblem I’m getting the following error when recreating the code block highlight example:
Invalid syntax highlight definitions: define at least one highlight.js language mapping.
I’ve installed highlight.js, imported it and passed on the languages object as described in the example.
I’m unsure as to how to debug this unfortunately. I’ve tried a few different things but can’t seem to get it working. Any help would be appreciated!
Screenshots
Environment
- OS: Windows 10
- Chrome
- Version 1.27.1
- Desktop
- Using Nuxt
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Javascript syntax highlighting it not working
For me it starts to work when "Enable the new JavaScript language service" (Options->Text Editor->JavaScript/TypeScript->Language Service) is set to unchecked.
Read more >highlight.js demo
function $initHighlight(block, cls) { try { if (cls.search(/\bno\-highlight\b/) != -1) return process(block, true, 0x0F) + ` class="${cls}"` ...
Read more >Improving syntax highlighting language auto-detection
If a question has exactly one tag with an associated highlight language, all code blocks in the post get highlighted with that language....
Read more >Extension:Highlightjs Integration - MediaWiki
js a client-side JavaScript highlighter. It makes the wikis which use a lot of syntax highlighting faster.
Read more >GNU Source-highlight 3.1.8
The meaning of the suffix -css is explained in Output Language map. ... SHJS is a JavaScript program that highlights source code passages...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
After debugging the source of
tiptap-extensions
, I’ve found that the actual error has nothing to do with how you pass languages. It still should be:The error however is the following:
Apparently it comes from version mismatch of the
highlight.js
. In mypackage.json
I have^10.1.1
, butlowlight
depends on version9.16.2
. Fixed the issue by setting the version ofhighlight.js
to^9.16.2
in thepackage.json
:I can’t reproduce the issue, so I guess it’s fixed by now? I’m closing this here for now, but feel free to chime in if you think it’s still relevant. ✌️