# @moevis/remark-mermaid-plugin

> remark mermaidjs plugin

Latest version **1.0.6** (published 2022-08-29) · ISC license · 0 weekly downloads

## Install

```sh
npm install @moevis/remark-mermaid-plugin
pnpm add @moevis/remark-mermaid-plugin
yarn add @moevis/remark-mermaid-plugin
bun add @moevis/remark-mermaid-plugin
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.6 |
| Published | 2022-08-29 |
| First published | 2022-08-29 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 6 KB |
| Known vulnerabilities | 0 (+7 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | moevis |
| Keywords | remark, mermaid |

## Links

- npm: https://www.npmjs.com/package/@moevis/remark-mermaid-plugin
- npm.io page: https://npm.io/package/@moevis/remark-mermaid-plugin

## Dependencies (4)

- [mdast](https://npm.io/package/mdast.md) ^3.0.0
- [mermaid](https://npm.io/package/mermaid.md) ^9.1.5
- [unified](https://npm.io/package/unified.md) ^10.1.2
- [unist-util-visit](https://npm.io/package/unist-util-visit.md) ^4.1.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.6 (latest) — 2022-08-29
- 1.0.4 — 2022-08-29
- 1.0.3 — 2022-08-29

## README

# remark-mermaid-plugin

remark plugin to support mermaid for browser use, helpful for react-markdown

## Install

```sh
npm install @moevis/remark-mermaid-plugin
```


## Usage

Our module `exampl.js` looks as follows:
```js
import ReactMarkdown from "react-markdown";
import rehypeRaw from "rehype-raw";
import rehypeStringify from "rehype-stringify";
import remarkMermaidPlugin from '@moevis/remark-mermaid-plugin';

const markdownContent = `
    ```mermaid
    graph LR
      excute1[i = 1]
      excute2[j = 0]
      excute3[i ++]
      excute4["a = arr[j], b = arr[j + 1]"]
      excute5[change a, b]
      excute6[j ++]
        judge1["i < n"]
        judge2["j < n - i"]
      judge3["a > b"]
      start --> excute1
      excute1 --> judge1
      judge1 --Y--> excute2
      excute2 --> judge2
      judge2 --Y--> excute4
      judge2 --N--> excute3
      excute3 --> judge1
      excute4 --> judge3
      judge3 --N--> judge2
      judge3 --Y--> excute5
      excute5 --> excute6
      excute6 --> judge2
      judge1 --N--> end
    ```
`

function Markdown() {

  return (
    <ReactMarkdown
      children={markdownContent}
      remarkPlugins={[
        [remarkMermaidPlugin, { theme: "dark" }],
      ]}
      rehypePlugins={[
        rehypeRaw,
        rehypeStringify,
      ]}
    />
  );
}

```

or 

```js
<ReactMarkdown
  children={markdownContent}
  remarkPlugins={[
    remarkMermaidPlugin
  ]}
  rehypePlugins={[
    rehypeRaw,
    rehypeStringify,
  ]}
/>
```

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