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

**URL:** <https://talk.commonmark.org/t/mermaid-generation-of-diagrams-and-flowcharts-from-text-in-a-similar-manner-as-markdown/1882>\
**Category:** Uncategorized\
**Created:** [October 11, 2015, 9:26am UTC](https://talk.commonmark.org/t/mermaid-generation-of-diagrams-and-flowcharts-from-text-in-a-similar-manner-as-markdown/1882 "2015-10-11T09:26:12Z")\
**Posts on this page:** 1\
**Showing post:** 55

<div class="post-metadata">

**Author:** ![vas](https://cdn.commonmark.org/user_avatar/talk.commonmark.org/vas/32/1267_2.png) [@vas](https://talk.commonmark.org/u/vas)\
**Post date:** [February 11, 2022, 3:33pm UTC](https://talk.commonmark.org/t/mermaid-generation-of-diagrams-and-flowcharts-from-text-in-a-similar-manner-as-markdown/1882/55 "2022-02-11T15:33:51Z")

</div>

> [@vitaly](#):
>
> Let’s consider variants:
> 
> - `!mermaid` + `mermaid`
> - `draw:mermaid` + `mermaid`
> - `mermaid` + `mermaid_src`
> 
> All have 2 labels (one for diagram, one for source).
> 
> - first is difficult to understand.
> - second - readable, but may be verbose
> - last reflects usage frequency
> 
> I’m still not sure, what is better, 2 or 3, but i don’t like 1.

You forgot [my proposal](https://talk.commonmark.org/t/mermaid-generation-of-diagrams-and-flowcharts-from-text-in-a-similar-manner-as-markdown/1882/47) 😉

#### Proposals: Syntax and Semantics

| | explicit “show code” semantics | explicit “execute code” semantics | non-explicit, do what is usually expected / most natural |
| --- | --- | --- | --- |
| A | `mermaid` | `!mermaid` | |
| B | `mermaid` | `draw:mermaid` | |
| C | `mermaid_src` | | `mermaid` |
| D | `mermaid =` | `mermaid ()` or  
`mermaid (` … `)` | `mermaid` |

- A: not bad, but breaks existing things, and _“rare case should not “poison” major cases”_

- B: readable, but uses English, and same problems as `A`

- C: reflects usage frequency, but then some users will naturally start using `markdown_src` and even `javascript_src`, so those should be supported. Also, for those things like `javascript` and `markdown` that by default are “show code”, how do you say “execute code”? Will we then add `markdown_draw`? If we do, we’ve ended up doing `D`, but not as nicely.

- D: semantics of non-explicit form reflects usage frequency. Author can always choose to be explicit. Is consistent and logical (semantic explicitness in _both_ cases is syntactically explicit). Does not use English. Tokens make sense. Uses second token rather than modding the first, so more backward compatible, degrades gracefully in vast majority of cases.

---

_[View the full topic](https://talk.commonmark.org/t/mermaid-generation-of-diagrams-and-flowcharts-from-text-in-a-similar-manner-as-markdown/1882)._
