Seao / grav-plugin-diagrams

Diagrams is a Grav plugin that adds simple and powerful diagrams functionality
MIT License
40 stars 12 forks source link

mermaid integration #1

Closed pubmania closed 7 years ago

pubmania commented 7 years ago

Thanks for this useful plugin. Would it be possible to integrate mermaid to this plugin?

With my limited understanding of code, I wonder if it is as simple as adding the mermaid.js into the js directory and then including the line $this->grav['assets']->addJs('plugin://diagrams/js/mermaid.js'); in diagrams.php at line 132?

Seao commented 7 years ago

Hi @pubmania ,

Thanks for your feedback!

I added mermaid support to the plugin (https://github.com/Seao/grav-plugin-diagrams/commit/c0dd8ee42410c00d02ef27da5fe48bdbdbaf21d3). This modification is currently not deployed on GPM, which mean you have to install the plugin manually.

Usage instructions are available on the README. Could you please try it, and if everything is working for you I will deploy it for everyone and close this issue 😉

pubmania commented 7 years ago

Hi @Seao ,

Thanks for the quick response. It is indeed working. I checked with sequence diagram and gantt chart and both work wonderfully well.

It can be deployed to GPM indeed. Although I wonder if it will be possible to do one more addition to the feature for Gantt....How it goes is like this:

For Gantt charts, mermaid uses d3 js library and the default period is in weeks. Now the markdown plus tool allows for Gantt X-axis formatting ... if you look at their demo here.

Is it something that can be implemented under settings or even on per post basis.

Seao commented 7 years ago

It's now possible to modify the axis of gantt diagram in the plugin's parameters (https://github.com/Seao/grav-plugin-diagrams/commit/1f7976b0192aa3443eba6e90143998ad2d44565f). I will push a new version on GPM, it will be available soon. Of course manually install is still possible :)

pubmania commented 7 years ago

Fabulous...You are absolute star. Thanks :+1: