Mermaid support out of the box #1259
Replies: 8 comments 15 replies
-
UPD see solution in the comment bellow #1259 (reply in thread) Article about different configuration options https://astro-digital-garden.stereobooster.com/recipes/mermaid-diagrams-in-markdown/ old answerI think I got to the bottom of the problem. There are two options:remark-mermaidjsUse But author (of the plugin) advice against it rehype-mermaidjsIt would work with In this case you need either:
PSMy post about Astro diagram solutions |
Beta Was this translation helpful? Give feedback.
-
None of the approaches listed above worked for me. However, this did |
Beta Was this translation helpful? Give feedback.
-
Not Mermaid, but sharing an Astro integration for the D2 diagramming language that @HiDeoo built that might also be of interest to people in this thread: https://astro-d2.vercel.app/ |
Beta Was this translation helpful? Give feedback.
-
Also interested in this capability. Pretty much makes it unusable for tech docs without it. We're currently testing with mdbook which you can add mermaid to very easily. Docs currently built with Docker using this: FROM rust as book-build
RUN cargo install mdbook
RUN cargo install mdbook-mermaid
WORKDIR /app
COPY --from=preparation-stage /app .
RUN mdbook build We're not a rust shop though, so was looking at alternatives. mkdocs also appears to support mermaid fairly easily too. This would genuinely be a great addition out of the box. |
Beta Was this translation helpful? Give feedback.
-
EDIT: This answer is outdated. See @HiDeoo’s Mermaid solution below for the latest and simplest set-up. Original commentJust did some testing to get
I didn’t get far enough to work out if there’s a nicer way to handle dark/light mode support, but maybe this is a good starting point for someone to iterate on or even publish as a community package! |
Beta Was this translation helpful? Give feedback.
-
I found this site which is so good to support Mermaid. |
Beta Was this translation helpful? Give feedback.
-
Related: implemented small library to add pan/zoom functionality to SVG, img - https://github.com/stereobooster/svg-pan-zoom-gesture |
Beta Was this translation helpful? Give feedback.
-
Just in case if anybody is interested, |
Beta Was this translation helpful? Give feedback.
-
What version of
starlight
are you using?N/A
What is your idea?
Starlight should support Mermaid diagrams either our of the box, or as an official plugin. It's really dumb that it doesn't
Why is this feature necessary?
Setting it up by yourself is a ton of work, and its really buggy.
You can do so by adding the following to
astro.config.mjs
:However if you do so you MDX support crashes. So you also have to add the following:
And after all of that work it only works when
starlight
is in light-mode, as it only generate styling for one mode out of the box. Adding support to integrate withstarlight
s dark- and light-mode would be even more work.This should ultimatly just be supported by
startlight
if they want to be serious alternative.Do you have examples of this feature in other projects?
Docusaurus have an official plugin thats super easy to use
https://docusaurus.io/docs/markdown-features/diagrams
Participation
Beta Was this translation helpful? Give feedback.
All reactions