-
Notifications
You must be signed in to change notification settings - Fork 18
Add support for mermaid.js
diagrams.
#1338
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Included `"mermaid": "11.0.2"` and other required dependencies to support additional functionalities.
…g is fully published to the link registry
I'm wondering why there is such a big lag until it renders the mermaid diagram. |
We might also want to explore lazy loading mermaid as a follow-up. Especially, if we need the full mermaid at some point. |
IMO it would look nice to show something like a loading spinner or skeleton loader instead of the raw mermaid text. |
Yeah this really stumped me too. The main distribution of
yeah this is needed before merging, it's not a great look otherwise. |
docs/syntax/diagrams.md
Outdated
@@ -0,0 +1,164 @@ | |||
# Diagrams | |||
|
|||
You can embedd diagrams using [mermaid.js](https://mermaid.js.org) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also add here which diagrams are not supported? (and maybe why)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Edited the docs right now
@Mpdreamz @reakaleek I wonder if switching to the |
The slight rendering delay I notice in the video... Is this something we could avoid? Maybe through lazy loading (didn't check if we implement it)? Would loading Mermaid from the CDN help? |
parcel barfs pretty hard on a regular import.
The following is the only way to make it 'work' with the main npm module but it being a esm tagetting browsers makes me think it shouldn't work.
And while that works we we end up with a gazilion (200+) files in
/_static
I therefor opted to depend on https://www.npmjs.com/package/@mermaid-js/tiny instead which is manually copied over to
_static
.tiny is a bit of a misnomer its still
1.6mb
so we only load these script if the page is actually using mermaid.This does not support
Preview: https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/1338/syntax/diagrams
cursorful-video-1748982940773.mp4