Mermaid - Generation of diagrams and flowcharts from text in a similar manner as markdown

I’m a bit late to the party here: I had thought this just had to do with mermaid, which I don’t really care about, but it actually has implications far beyond that, so I do have something to say.

I think it’s always very useful to try to keep in mind prior art and not reinvent the wheel in 17 different ways. Pandoc and a number of other implementations have long supported attributes in braces: e.g.,

``` {.mermaid theme=forest}
```

And no, pandoc didn’t invent this syntax; it was already prior art more than a decade ago (e.g. from PHP Markdown Extra). A bare word is allowed when it’s just a class and there are no other attributes:

``` mermaid
```

The braces make it extremely clear that this material is not part of the text, but more like metadata. They also help reduce the ambiguities between fenced code and hard-wrapped inline code. After all, inline code is allowed to start with three backticks, and might contain text like mermaid theme=forest.

4 Likes