saneef / eleventy-plugin-asciidoc

Eleventy plugin to add support for AsciiDoc.
MIT License
25 stars 6 forks source link

Support for Mermaid and Asciidoctor diagrams #8

Closed DonClysdale closed 1 year ago

DonClysdale commented 1 year ago

It would be really nice to support Mermaid and asciidoctor diagrams in asciidoc pages, like mermaid diagrams are supported in eleventy for markdown pages.

saneef commented 1 year ago

The official Asciidoctor Diagram doesn't support Node.js. So, I don't plan to support for diagrams like Mermaid by default.

Having said that, I'll see whether it is possible to support Mermaid diagrams like I did for build time syntax highlighting for Asciidocs.

saneef commented 1 year ago

@DonClysdale I checked the feasibility of rendering Mermaid.js diagrams on build side. Unfortunately, Mermaid.js only renders the charts within a browser. The approaches out there are using headless browsers to render the charts. It is out of the scope of this plugin.

I recommend using a literal or code block of AsciiDoc to write Mermaid code, and use client-side rendering.

saneef commented 1 year ago

Here, https://github.com/saneef/eleventy-plugin-asciidoc-tester/commit/10414eede83f215aed3aef8ee2c0c13883f28f23, is how I set up client-side rendering of Mermaid.js with AsciiDoc.