dart-lang / markdown

A Dart markdown library
https://pub.dev/packages/markdown
BSD 3-Clause "New" or "Revised" License
443 stars 202 forks source link

This PR illustrates the simple changes needed to the example code to support Mermaid Diagrams. Resolves #228 #429

Closed timmaffett closed 2 years ago

timmaffett commented 2 years ago

This PR illustrates the changes need to the example code to use the mermaid.dart package (interop wrapper for mermaid.js). This package resolves #228 , in so much as it implements support for Mermaid as @srawlins mentions in his last comment.

Here is an example illustrating a number of Mermaid diagram types

(I also wrote the mermaid.dart package to interop wrap the mermaid.js library. Github repo)

Mermaid is very fast to render and you can edit the chart source in real time and see the rendering.

One unfortunate thing I learned about the mermaid js package while creating this is that it requires the browser DOM to create the SVG files, so server side use of the mermaid.dart package is not possible. (There is a mermaid-cli project that creates a command line version of mermaid using puppeteer some server side solution could be made invoking that from dart).

Other than that I was very impressed with the mermaid.js diagram support.

I don't know if this PR has a place in markdown proper, but I wanted to submit it to illustrate how simple the code was to support mermaid diagrams in conjunction with markdown.

kevmoo commented 2 years ago

Cool! I don't think this has a place here. There are so many ways to extend these packages.

Great work, though!