Skip to content

YoniFeng/astro-mermaidjs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Temporary alternative for https://www.npmjs.com/package/astro-diagram (which needs fixes merged)

Enables using MermaidJS diagrams inline in .md(x) files in Astro. Utilizing Playwright during build time, the HTML for diagrams is generated, and the snippets replaced.

Installation

npm install astro-mermaidjs

yarn install astro-mermaidjs

pnpm install astro-mermaidjs

Usage

In your astro.config.{ts,mjs}:

import remarkMermaid from 'astro-mermaidjs/remark-mermaid';
// ...

export default defineConfig({
  // ...
  markdown: {
    remarkPlugins: [
      // ...
      remarkMermaid,
    ],
  },
  // ...
});

Then in .md(x) files, use the regular mermaid DSL like you would on Github or other mermaid-supporting markdown flavors:

```mermaid
sequenceDiagram
    Client-->Server: ping
    Server-->Client: pong
```

About

astro-mermaidjs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published