Skip to content

Add support for Mermaid diagrams

Sarah German requested to merge 13-mermaid into main

What does this MR do and why?

Adds support for Mermaid charts.

This follows the implementation described in the Hugo docs (https://gohugo.io/render-hooks/code-blocks/#examples), except we're fetching the Mermaid library as part of our build process (with Yarn + Vite) rather than loading it over the web from a CDN. The frontend build step is very similar to how we've done this with Nanoc/Rollup (src).

Closes #13 (closed)

Screenshots, screen recordings, or links to review app

Examples:

These aren't the prettiest examples; this sampling is courtesy of a recent discussion on problematic charts here: gitlab-org/gitlab#458994. In this case, we want the Hugo diagrams to look just like the Nanoc diagrams, as imperfect as they are.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Configure a local GitLab Docs environment: https://gitlab.com/gitlab-org/technical-writing-group/gitlab-docs-hugo/-/blob/main/doc/setup.md.
  2. View the example links listed above (or any others). They should render the same as they do on the Nanoc site.

Merge request acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Sarah German

Merge request reports