question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Code Block Highlight not working (Invalid syntax highlight definitions: define at least one highlight.js language mapping)

See original GitHub issue

Problem 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 image image

Environment

  • OS: Windows 10
  • Chrome
  • Version 1.27.1
  • Desktop
  • Using Nuxt

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

6reactions
egorovlicommented, Jun 30, 2020

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:

new CodeBlockHighlight({
  languages: { javascript, css, xml }
})

The error however is the following:

image

Apparently it comes from version mismatch of the highlight.js. In my package.json I have ^10.1.1, but lowlight depends on version 9.16.2. Fixed the issue by setting the version of highlight.js to ^9.16.2 in the package.json:

{
  // ...
  "dependencies": {
    "highlight.js": "^9.16.2"
  },
  // ...
}
0reactions
hanspagelcommented, Jan 7, 2021

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. ✌️

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found