JSON in highlight.js

christophe's Avatar


19 Jun, 2012 07:20 PM


From what I can see, it seems the version of highlight that's included in the document when the "automatic syntax highlighting" preference checkbox is selected is a stripped one, that only understood a bunch of langages instead of the whole set. In particular, it doesn't include json highlighting.
It is the same for the included css doing syntax highlighting.

do you think it would be possible to put a full-fledged highlight.js directly inside Marked, instead of the "lite" one? And at least the default.css from highlight.js ?

Thanks a lot.

  1. Support Staff 1 Posted by Brett on 19 Jun, 2012 07:37 PM

    Brett's Avatar

    It's all there, I believe, it just fails to recognize certain languages sometimes. I've been looking into improving it, but it's a bit stubborn.

  2. 2 Posted by christophe on 19 Jun, 2012 11:15 PM

    christophe's Avatar

    Hello, thanks for your fast answer.

    No, I think it's really not in the highlight.js that's inside Marked. Looking in highlight.js in Content/Resources in the app bundle, there's hljs.LANGUAGES.javascript and other hljs.LANGUAGES.xxx but no hljs.LANGUAGES.json.
    Looking here : http://yandex.st/highlightjs/7.0/highlight.min.js, there's a hljs.LANGUAGES.json.

    One thing that's strange is that I tested replacing the highlight.js and the syntax/xxx.css files in the app bundle with the one downloaded from http://softwaremaniacs.org/soft/highlight/en/download/, and the result is not as expected. Inside Marked, the code is still not highlighted, but when I do a "save to html", with template included, then the html IS highlighted.

  3. Support Staff 3 Posted by Brett on 20 Jun, 2012 01:08 AM

    Brett's Avatar

    Thanks for the tip, I'll make sure that gets added. The second part is odd, though, can't think of an immediate reason why that would happen. I'll test.

  4. Support Staff 4 Posted by Brett on 20 Jun, 2012 01:26 AM

    Brett's Avatar

    Hey, I just ran it with the upgraded (7.0) version of highlight and it worked *wonders*. If you'd like a look at the beta version with vastly improved fenced code handling and the updated highlight.js, shoot me an email here: http://brettterpstra.com/contact/


  5. 5 Posted by luxlogica on 08 Dec, 2012 12:43 PM

    luxlogica's Avatar

    Looking forward to the improved syntax highlighting - also experiencing frustration with json and shell/bash syntax...

  6. 6 Posted by canyaman on 15 Feb, 2013 10:58 AM

    canyaman's Avatar

    Thanks christophe

    I have resolved problem with changing content of the marked.min.js. marked.min.js file consists of jquery.js, highlight.js and other script. If you replace old highlight.js content(as text) with new one, you can highlight json.

  7. Support Staff 7 Posted by Brett on 15 Feb, 2013 11:00 AM

    Brett's Avatar

    Yes, this is already updated for the next release.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac