2.1.0 • Published 2 years ago

mermaid-parse v2.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

https://img.shields.io/npm/v/mermaid-parse Commitizen friendly semantic-release https://img.shields.io/github/languages/top/yousifalraheem/mermaid-parse https://img.shields.io/npm/l/mermaid-parse npm bundle size codecov

mermaid-parse

Parses Mermaid definitions into mermaid svg diagram.

Installation

Npm

npm i mermaid-parse

Yarn

yarn add mermaid-parse

Usage

import mermaidParse from 'mermaid-parse';

const definition = `
    graph TD
    A[Christmas] -->|Get money| B(Go shopping)
    B --> C{Let me think}
    C -->|One| D[Laptop]
    C -->|Two| E[iPhone]
    C -->|Three| F
`;

mermaidParse(definition, { extension: 'png' }).then(htmlRes => {
    res.send(htmlRes);
});

Configuration

Currently supported configurations:

optiontypedescriptiondefault
extension?"svg" | "png"The output extensionsvg

Documentation

This package uses Mermaid-js to transform the definition to svg diagram in HTML string format.

If you want to know how the definition is composed please read mermaid-js documentation.

This version does not support theming and other customization. Instead, it uses mermaid defaults. There are plans to support further configurations in the future.

The intended use for this package is to transform diagrams in node backend service and return it as a response.

License

MIT

2.1.0

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago