Repository navigation
feat: Add support for rendering mermaid diagrams - #62
Merged
Merged
Conversation
Member
Author
|
An example of an ADR that requires this is in #61. |
memalhot
approved these changes
Nov 20, 2026
knikolla
approved these changes
Nov 20, 2026
Comment on lines
+54
to
+57
| <script src="/_assets/mermaid.min.js"></script> | ||
| <script> | ||
| mermaid.initialize({ startOnLoad: true }); | ||
| </script> |
There was a problem hiding this comment.
mermaid.min.js is about 5.5 MB and is requested on every page, including the ones with no diagram. Optional: load it only when the page has one.
Suggested change
| <script src="/_assets/mermaid.min.js"></script> | |
| <script> | |
| mermaid.initialize({ startOnLoad: true }); | |
| </script> | |
| <script> | |
| if (document.querySelector("pre.mermaid")) { | |
| const script = document.createElement("script"); | |
| script.src = "/_assets/mermaid.min.js"; | |
| script.onload = () => { | |
| mermaid.initialize({ startOnLoad: false }); | |
| mermaid.run(); | |
| }; | |
| document.head.appendChild(script); | |
| } | |
| </script> |
atyronesmith
left a comment
There was a problem hiding this comment.
I tested this branch with the ADR from #61 added: all three Mermaid diagrams render (headless Chrome).
One more optional thing, in a file this PR doesn't touch: the rendered diagram keeps the grey pre background from _assets/style.css. If you'd rather it sit on the page background:
pre.mermaid[data-processed] {
background-color: transparent;
padding: 0;
text-align: center;
}Github has support for rendering inline mermaid diagrams, so we should support this on the published site as well. Like Github, this utilizes a client-side renderer (diagrams are rendered when viewed, rather than rendered to static files at build time).
larsks
force-pushed
the
feature/mermaid
branch
from
November 20, 2026 15:52
00c00c8 to
bc9557e
Compare
Member
Author
That seems like a reasonable change; I've added it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Github has support for rendering inline mermaid diagrams, so we should
support this on the published site as well. Like Github, this utilizes a
client-side renderer (diagrams are rendered when viewed, rather than
rendered to static files at build time).