Allow Mermaid diagrams in Suttacentral and Discourse

Mermaid is a diagramming and charting tool that allows diagrams to be drawn using Markdown inspired syntax.

For more information, refer to Mermaid

Github enables mermaid, so it would be nice for this to be available in the main web site and discourse forum as well.

I believe there is a Discourse plugin for mermaid:

Discourse-Mermaid plugin

Adding @musiko to the conversation.

Is this something that would be possible to add?
Any idea of pros and cons?

1 Like

What would be the purpose of the change? What would it accomplish, that was lacking until now?

2 Likes

I believe @christie is referring to the style of posting sheā€™s currently doing on her website:

1 Like

I understand, but what would be an added benefit of enabling this directly on the forum, as opposed to linking to the source?

3 Likes

I would like to be able to embed these diagrams directly in a post, rather than embedding an image, which requires more storage.

Thanks Musiko, good point. The question would be about expected usage in the forum

What are some examples of use cases for these diagrams, please?

Please have a look at this GitHub issue:

As per @sujatoā€™s suggestion, I am experimenting with a way of doing trilinear translation of Pali suttas, combined with grammatical analysis. I am playing with the idea of using pseudo UML diagrams to convey the grammatical analysis. I would like to post such diagrams on Discourse for others to provide feedback. It will be much easier if I can embed the diagrams directly into a post rather than link to a webpage every time. Because then I have to create and publish that webpage first.

If this method proves to be of merit, the next step is I would like to publish these translations on Bilara. If we enable mermaid support in Bilara/suttacentral, then such translations can be published without any further changes to Bilara.

2 Likes

Iā€™m usually reluctant to add extensions (especially third party unmaintained plugins) for maintenance and stability reasons, but in this case you might just be in luck, since there is an official theme component, which I can enable on the fly.

Here are the instructions on how to use the syntax inside the post:

5 Likes
classDiagram
  class `tathāgato bhāsati` {
    <<sentence>>
    english(The Tathāgata speaks)
  }
  class tathāgato {
    <<noun>>
    masculine
    nominative
    singular
    english("thus-gone")
  }
  class bhāsati {
    <<verb>>
    āˆšbhās
    present
    3rd person
    singular
    english(speaks)
  }
  `tathāgato bhāsati` *-- tathāgato : agent
  `tathāgato bhāsati` *-- bhāsati : action

6 Likes
flowchart LR
you(((you)))  
 thank --> you
2 Likes

Awesome, nice additions folks! Mermaid is great, Iā€™ve used it a few times, I had no idea you could add it to Discourse!

1 Like