I'm trying to generate a documentation from markdown files via mkdocs (with material) to publish on gitlab. My files include code blocks and mermaid diagramms, which are declarated the same (differentiated in the language). I would like to use CodeHilite to beautify the code blocks but the mermaid blocks will also be processed by it as code blocks and than will get ignored by the mermaid-mkdocs plugin. Is there a way, I could exclude certain blocks from codeHilite or any other change to use both together?
If you use the mermaid2 plugin, the readme contains a section on Using Mermaid and code highlighting at the same time.
You would have to use superfences in this way:
markdown_extensions:
- pymdownx.superfences:
# make exceptions to highlighting of code:
custom_fences:
- name: mermaid
class: mermaid
format: !!python/name:mermaid2.fence_mermaid
Note: @streuspeicher is correct in saying you don't have to use the mermaid2 plugin to exploit mermaid diagrams, if you have an average knowledge of mkdocs, javascript libraries, etc.
I designed mermaid2 [disclosure] with two types of users in mind:
Beginners who have little knowledge of css, javascript etc and basic needs with mermaid. They simply have to declare mermaid2
under their list of plugins, and it's going to work out of the box.
On the other extreme, advanced users who really want to tweak their use of mermaid, with theming, callbacks, etc. and want to have a reliable framework to do that.
If you are in the sweet spot (of having basic needs with mermaid diagrams, and you are confident with extensions, css, javascript, etc.) you can happily do without mermaid2.