Socket
Book a DemoInstallSign in
Socket

@moevis/remark-mermaid-plugin

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@moevis/remark-mermaid-plugin

remark mermaidjs plugin

latest
npmnpm
Version
1.0.6
Version published
Maintainers
1
Created
Source

remark-mermaid-plugin

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

Install

npm install @moevis/remark-mermaid-plugin

Usage

Our module exampl.js looks as follows:

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

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

Keywords

remark

FAQs

Package last updated on 29 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts