preaction / Statocles

Static website CMS
http://preaction.me/statocles
Other
84 stars 33 forks source link

Add plugin for using mermaid to generate diagrams #525

Open preaction opened 7 years ago

preaction commented 7 years ago

http://knsv.github.io/mermaid/index.html#mermaid

Mermaid uses client-side rendering to render diagrams written in a simple, plain text style. These are excellent for presentations and documentation, and it would be good to have integrated support for it.

This could be done as a plugin, Statocles::Plugin::Diagram::Mermaid, which exports a template helper diagram. The helper would take the diagram syntax as a block, like:

%= diagram begin
A->>B
% end

Using the helper on a page would add the appropriate script elements to the page. The libraries themselves could be loaded from a CDN, with an option to set the URL to load the libraries from.

The plugin should be named Statocles::Plugin::Diagram::Mermaid so that we can have other diagram plugins in the future (like Ditaa)