question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Native Mermaid.js integration

See original GitHub issue

Experimental support has been released as part of Insiders 1.15.0!

Many users have problems setting up Mermaid for drawing graphs. Material for MkDocs wants to make drawing graphs as simple as adding the relevant graph definition to a Markdown file with everything else automatically being taken care of.

Goals

I’m working on a native Mermaid.js integration as part of Insiders, which will have the following nice properties:

  • The theme will automatically set up Mermaid.js as soon as it sees a .mermaid block
  • This will work perfectly with instant loading and only load the rather bulky mermaid.js when necessary
  • It works with dark mode and is easily customizable through CSS variables
  • The colors and fonts will adapt to those chosen by the author in mkdocs.yml
  • Omit common problems with Mermaid (i.e. duplicate IDs)
  • Consider offline support

While all graph types are supported, not all of them will adapt to the chosen colors and fonts (yet). The progress so far:

  • Flow charts
  • Class diagrams
  • State diagrams
  • Sequence diagrams
  • Entity-Relationship diagrams
  • User Journeys
  • Gantt charts
  • Pie charts

Usage

Support is currently experimental and can be enabled by adding the following configuration to mkdocs.yml:

markdown_extensions:
  - pymdownx.superfences:
      custom_fences:
        - name: mermaid
          class: mermaid-experimental
          format: !!python/name:pymdownx.superfences.fence_code_format

Material for MkDocs will take care of the rest, only initializing Mermaid.js when necessary. Furthermore, Instant Loading and Mermaid will work perfectly together, so the setup is only necessary once.

Preview Bildschirmfoto 2021-01-01 um 16 50 46 Bildschirmfoto 2021-01-01 um 16 51 02

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:9
  • Comments:35 (26 by maintainers)

github_iconTop GitHub Comments

2reactions
squidfunkcommented, Feb 23, 2021

I’m currently in the process of migrating Insiders over to v7 and will tackle the Mermaid integration in the next weeks! Sorry for the inconvenience.

2reactions
wilhelmercommented, Jan 5, 2021

The documentation is incorrect. The config snippet includes:

format: !!pymdownx.superfences.fence_code_format

but it should be (as stated above):

format: !!python/name:pymdownx.superfences.fence_code_format

With that change, it runs fine. Looks great, now I have to learn Mermaid 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

mermaid/integrations.md at develop - GitHub
Integrations. The following list is a compilation of different integrations and plugins that allow the rendering of mermaid definitions within other ...
Read more >
Integrations | Mermaid
The following list is a compilation of different integrations and plugins that allow the rendering of ... GitHub (Native support) ... Plugin for...
Read more >
Include diagrams in your Markdown files with Mermaid
Mermaid is a JavaScript based diagramming and charting tool that takes Markdown-inspired text definitions and creates diagrams dynamically ...
Read more >
Making Mermaid Diagrams in Markdown - CSS-Tricks
Hopefully, we'll see more native Mermaid integrations like this as Mermaid continues to grow in popularity. The usefulness of having visual ...
Read more >
Visualizing use cases using mermaid.js - Undabot
Step 5: Integrate the diagram. The diagrams are great, but in isolation, they don't do much, they need to be integrated into the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found