Code block type and syntax highlighting

I installed the better code blocks plugin today. When i was switching from live preview to reader mode i noticed the reader mode didn’t have syntax highlighting but the live preview mode did. It turns out that i has set the code block type to “c++” and that showed the syntax highlighting only in live preview. If you change the type to “cpp” then it works in both modes. It’s not exactly a bug as such, but where is the list of code block types to be found?

I haven’t used better code blocks, but the list for Reading View coloring, handled by Prism.js, is linked in the code block section of the help documentation.

https://prismjs.com/#supported-languages

1 Like

Interesting that c++ worked at all, but I beleive that a different js tool is used when displaying syntax higlighting in preview mode. Why would obsidian not use the same tool for both?

Yeah, for Editing Views (source and Live Preview), CodeMirror is the engine and taking care of the syntax highlighting.

I imagine Prism.js can’t be used in Editing View / with CodeMirror, but I can’t say for sure.