jenkins-infra / jenkins.io

A static site for the Jenkins automation server
https://jenkins.io
Other
320 stars 1.22k forks source link

Support for Mermaid diagrams #6811

Open basil opened 11 months ago

basil commented 11 months ago

Suggestion

In #6809 I tried to include a Gantt chart via Mermaid and asciidoctor-diagram, but it wasn't practical. Even after adding asciidoctor-diagram to Gemfile and after adding @mermaid-js/mermaid-cli to package.json, I still ran into a number of issues. For one, there was no straightforward way to enable the asciidoctor-diagram extension from Awestruct. But even after hacking around this, I ran into a fundamental problem. asciidoctor-diagram requires the mmdc tool from mermaid-cli to be installed when it is running, but that is a JavaScript (not Ruby) package, and our build currently has separate stages and separate Docker environments for JavaScript and Ruby, so each environment is unavailable from the other. This does keep the build nice and simple by allowing us to use unmodified upstream Docker images, in contrast to having to maintain an omnibus build environment ourselves with every possible tool installed. But it also means that the Ruby environment running asciidoctor has no access to the JavaScript environment with mermaid-cli.

I worked around this issue in #6809 by running asciidoctor-diagram locally with its SVG backend to generate rendered SVG versions of the Gantt charts, which I included in that PR. But in the future it would be nice to be able to automatically render Mermaid markup. This would likely involve some deeper changes to the build.

Links

No response

zbynek commented 11 months ago

Ssince your usecase involved writing a blog post, it would be useful to know whether/when will the blog be split from the main site as suggested in https://github.com/jenkins-infra/jenkins.io/issues/5474#issuecomment-1264476822 (I'd imagine having all tools Node.js-based would simplify Mermaid integration a lot).

in contrast to having to maintain an omnibus build environment ourselves with every possible tool installed.

btw. the infra.ci builds are done using such omnibus image which overrides the use of dockerized Node and Ruby using env variables to use its own Node version 🤷