# gatsby-remark-mermaid

> Add pretty graphs using mermaid and server-side rendering.

Latest version **5.0.0** (published 2024-10-11) · ISC license · 0 weekly downloads

## Install

```sh
npm install gatsby-remark-mermaid
pnpm add gatsby-remark-mermaid
yarn add gatsby-remark-mermaid
bun add gatsby-remark-mermaid
```

## Health

**Score 40/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities; has provenance.

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 5.0.0 |
| Published | 2024-10-11 |
| First published | 2019-02-24 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 5.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 25 |
| Author | Thomas Biesaart |
| Maintainers | remcohaszing, chappio |
| Keywords | gatsby, gatsby-plugin, remark, drawing, plugin, mermaid, graph, flowchart, diagram |

## Links

- npm: https://www.npmjs.com/package/gatsby-remark-mermaid
- Repository: https://github.com/remcohaszing/gatsby-remark-mermaid
- Homepage: https://github.com/remcohaszing/gatsby-remark-mermaid#readme
- Issues: https://github.com/remcohaszing/gatsby-remark-mermaid/issues
- Funding: https://github.com/sponsors/remcohaszing
- npm.io page: https://npm.io/package/gatsby-remark-mermaid

## Dependencies (2)

- [vfile](https://npm.io/package/vfile.md) ^6.0.0
- [remark-mermaidjs](https://npm.io/package/remark-mermaidjs.md) ^7.0.0

## Alternatives

- [d3-force-3d](https://npm.io/package/d3-force-3d.md) — 1.0M weekly downloads
- [ng2-charts](https://npm.io/package/ng2-charts.md) — 486.8K weekly downloads
- [@arcgis/core](https://npm.io/package/@arcgis/core.md) — 257.8K weekly downloads
- [react-sparklines](https://npm.io/package/react-sparklines.md) — 249.3K weekly downloads
- [react-native-gifted-charts](https://npm.io/package/react-native-gifted-charts.md) — 182.3K weekly downloads

## Recent versions

- 5.0.0 (latest) — 2024-10-11
- 1.0.0-rc3 (next) — 2019-02-24
- 4.0.0 — 2023-05-07
- 3.0.1 — 2022-11-22
- 3.0.0 — 2022-11-21
- 2.1.0 — 2020-08-30
- 2.0.0 — 2020-05-07
- 1.2.0 — 2019-08-05
- 1.1.0 — 2019-07-19
- 1.0.1 — 2019-07-13
- 1.0.0 — 2019-02-24
- 1.0.0-rc2 — 2019-02-24
- 1.0.0-rc1 — 2019-02-24

## README

# gatsby-remark-mermaid

[![github actions](https://github.com/remcohaszing/gatsby-remark-mermaid/actions/workflows/ci.yaml/badge.svg)](https://github.com/remcohaszing/gatsby-remark-mermaid/actions/workflows/ci.yaml)
[![npm version](https://img.shields.io/npm/v/gatsby-remark-mermaid.svg)](https://www.npmjs.com/package/gatsby-remark-mermaid)
[![npm downloads](https://img.shields.io/npm/dw/gatsby-remark-mermaid)](https://www.npmjs.com/package/gatsby-remark-mermaid)
[![prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://prettier.io)

Create [mermaid](https://mermaidjs.github.io) graphs and diagrams in your markdown files.

This plugin uses [remark-mermaidjs](https://github.com/remcohaszing/remark-mermaidjs) to generate
SVG diagrams at build time. The mermaid code blocks are replaced with an inline SVG in the generated
HTML. This prevents any runtime dependencies on `mermaid`.

## Table of COntents

- [Installation](#installation)
- [Usage](#usage)
- [Options](#options)
  - [`browser`](#browser)
  - [`css`](#css)
  - [`errorFallback`](#errorfallback)
  - [`launchOptions`](#launchoptions)
  - [`mermaidConfig`](#mermaidconfig)
  - [`prefix`](#prefix)
- [Credits](#credits)
- [License](#license)

## Installation

```sh
npm install gatsby-remark-mermaid gatsby-transformer-remark
```

## Usage

Configure this plugin as a plugin of
[`gatsby-transformer-remark`](https://www.gatsbyjs.com/plugins/gatsby-transformer-remark/).

**NOTE:** Make sure you add this plugin **before** any other plugins that process code blocks.

Example configuration

```js
// In your gatsby-config.js
module.exports = {
  plugins: [
    {
      resolve: 'gatsby-transformer-remark',
      options: {
        plugins: [
          {
            resolve: `gatsby-remark-mermaid`,
            options: /** @type {import('gatsby-remark-mermaid').Options} */ ({
              mermaidConfig: {
                theme: 'neutral',
                themeCSS: '.node rect { fill: #fff; }'
              }
            })
          }
        ]
      }
    }
  ]
}
```

## Options

### `browser`

The Playwright browser to use. (`object`, default: chromium)

### `css`

A URL that points to a custom CSS file to load. Use this to load custom fonts. This option is
ignored in the browser. You need to include the CSS in your build manually. (`string` | `URL`)

### `errorFallback`

Create a fallback node if processing of a mermaid diagram fails. If nothing is returned, the code
block is removed. The function receives the following arguments:

- `node`: The mdast `code` node that couldn’t be rendered.
- `error`: The error message that was thrown.
- `file`: The file on which the error occurred.

### `launchOptions`

The options used to launch the browser. (`object`)

### `mermaidConfig`

The [mermaid config](https://mermaid.js.org/config/setup/modules/config.html) to use.

### `prefix`

A custom prefix to use for Mermaid IDs. (`string`, default: `mermaid`)

## Credits

This package was originally developed by [Thomas Biesaart](https://github.com/ChappIO).

## License

[MIT](LICENSE.md) © [Thomas Biesaart](https://github.com/ChappIO)

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