# gridsome-plugin-remark-mermaid

> Use mermaidjs in your markdown to create diagrams.

Latest version **1.0.1** (published 2020-03-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install gridsome-plugin-remark-mermaid
pnpm add gridsome-plugin-remark-mermaid
yarn add gridsome-plugin-remark-mermaid
bun add gridsome-plugin-remark-mermaid
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2020-03-15 |
| First published | 2020-03-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 7 |
| Unpacked size | 36.5 KB |
| Known vulnerabilities | 0 (+8 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Braincoke |
| Maintainers | brainc0ke |
| Keywords | gridsome, gridsome-plugin, mermaid, remark |

## Links

- npm: https://www.npmjs.com/package/gridsome-plugin-remark-mermaid
- Repository: https://github.com/Braincoke/gridsome-plugin-remark-mermaid
- Homepage: https://github.com/Braincoke/gridsome-plugin-remark-mermaid#readme
- Issues: https://github.com/Braincoke/gridsome-plugin-remark-mermaid/issues
- npm.io page: https://npm.io/package/gridsome-plugin-remark-mermaid

## Dependencies (7)

- [path](https://npm.io/package/path.md) ^0.12.7
- [mermaid](https://npm.io/package/mermaid.md) ^8.4.8
- [puppeteer](https://npm.io/package/puppeteer.md) ^2.1.1
- [unist-util-visit](https://npm.io/package/unist-util-visit.md) ^2.0.2
- [xast-util-to-xml](https://npm.io/package/xast-util-to-xml.md) ^1.0.0
- [unist-util-remove](https://npm.io/package/unist-util-remove.md) ^2.0.0
- [xast-util-from-xml](https://npm.io/package/xast-util-from-xml.md) ^1.0.0

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2020-03-15
- 1.0.0 — 2020-03-14

## README

# gridsome-remark-mermaid

Use [mermaid](https://mermaid-js.github.io) code blocks in your markdown file to generate diagrams with Gridsome and remark.

This plugin is heavily inspired by [gatsby-remark-mermaid](https://github.com/ChappIO/gatsby-remark-mermaid).
It uses **server-side rendering** to generate inline SVG code during the build process.

## Install

~~~bash
npm install gridsome-plugin-remark-mermaid
~~~

## Usage

Configure `gridsome.config.js` to use the plugin.
Make sure this plugin is imported before any other plugin that processes code blocks such as *@gridsome/remark-prismjs* or *gridsome-plugin-remark-shiki*.

~~~js
module.exports = {
  siteName: 'Gridsome Blog',
  siteDescription: 'A simple blog designed with Gridsome',
  plugins: [
    {
      use: '@gridsome/source-filesystem',
      options: {
        path: 'content/posts/**/*.md',
        typeName: 'Post',
        route: '/blog/:slug'
      }
    }
  ],
  transformers: {
    remark: {
      plugins: [
        // Add remark-mermaid plugin
        'gridsome-plugin-remark-mermaid',
        '@gridsome/remark-prismjs'
      ]
    }
  },
}
~~~

Then use mermaid code blocks in your markdown to generate diagrams:

  ~~~mermaid
  graph LR
    A --> B
    B --> C
  ~~~

## Styling

The generated SVG is wrapped in `<div class="mermaid"></div>` to help you customize your styles.

When using the `removeStyleTags` attribute, you will need to import your Mermaid themes yourself. You can find an example project [here](https://github.com/Braincoke/starter-gridsome-mermaid).

## Options

| Name            | Default               | Description                                                                                                                                                     |
| --------------- | --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| language        | "mermaid"             | The code block language triggering a SVG generation. Change it to `"graph"` to create diagrams with `~~~graph`.                                                 |
| theme           | "default"             | This value can be set to `"dark"`, `"neutral"`, `"forest"` or `"default"`. Try them on the [mermaid editor](https://mermaid-js.github.io/mermaid-live-editor/). |
| viewport.width  | 200                   | The desired viewport width                                                                                                                                      |
| viewport.height | 200                   | The desired viewport height                                                                                                                                     |
| removeStyleTags | false                 | Remove all style tags from the generated SVG. If you use this option you will have to import the mermaid css at some point                                      |
| id              | `mermaid-<currentTime>` | Sets the identifier of the SVG. Defaults to a unique ID based on the time of generation                                                                         |
| mermaidOptions  | {}                    | Pass some custom [mermaid configuration options](https://mermaid-js.github.io/mermaid/#/mermaidAPI?id=configuration) to `mermaid.initialize()`                                                                                    |

The default options are:

~~~js
{
  language: "mermaid",
  theme: "default",
  viewport: {
    width: 200,
    height: 200
  },
  id: null,
  removeStyleTags: false,
  mermaidOptions: {}
}
~~~

---
_Source: https://npm.io/package/gridsome-plugin-remark-mermaid · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
