Replies: 1 comment
-
They are highlighted if you set things up. One can argue whether it is better to include something in the theme that auto-runs highlighting in the browser, or something you configure on the backend that pre-highlights the code when generating the docs (like what Material requires). This argument is subjective, so I won't bother arguing for or against it, but instead will simply assert what is necessary for Material. The recommended way is to use SuperFences: https://squidfunk.github.io/mkdocs-material/reference/code-blocks/#superfences. Indented code blocks will also be highlighted when using the Highlight extension, but obviously, since you cannot specify a language, you would have to turn on language guessing. This is why SuperFences, which allows you to specify the language in the fence syntax is recommended. If you find extension usage unsatisfactory, feel free to try and setup highlight.js with Material if you prefer, but frankly, it's like an extension in your browser, so... 🤷♂️. You would likely still have to use SuperFences if you like fenced code blocks and then disable Pygments usage: https://squidfunk.github.io/mkdocs-material/reference/code-blocks/#highlight. Then you'd have to import highlight.js etc. |
Beta Was this translation helpful? Give feedback.
-
if I use the default 'readthedocs' theme all the syntax are highlighted for code blocks, with mkdocs-material they're not highlighted, I would expect the code syntax highlight works without any extensions?
Beta Was this translation helpful? Give feedback.
All reactions