Syntax Highlighting in Jigsaw

David Kanenwisher • December 6, 2023

jigsaw

Syntax highlighting in Jigsaw is done as you would expect. You create a Markdown code block and add the name of the language after the first set of backticks like so ```php.

If you use a language like Kotlin that isn't supported out of the box by Jigsaw you need to register it in source/_assets/js/main.js like so:

hljs.registerLanguage('kotlin', require('highlight.js/lib/languages/kotlin'));

After that's done all the rendered code blocks should have an hljs tag on them:

<code class="language-kotlin hljs">