Lukasss93 / saas-mermaid

Mermaid as a service

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mermaid as a Service

Docker Pulls Docker Image Version (latest semver)

img.png

πŸš€ Installation

πŸ”§ Manual

  1. Clone this repository: git clone lukasss93/saas-mermaid
  2. Install dependencies: npm install
  3. Run the server: npm start

πŸ“¦ Docker

docker run -p 8087:8087 lukasss93/saas-mermaid

πŸ‘“ Usage

Send a or request to http://localhost:8087/render endpoint.

Input

To send your chart text use:

  • text query string parameter when using method
  • plain text body when using method

To remove the background use:

  • background=transparent query string parameter. Optional. Default is white

To change the format append .<format> to the end of the url where <format> is one of the following:

  • svg
  • png
  • jpg

Optional. Default is svg

Output

The response will be a png, jpg, svg image.

You can use the X-Hash header to:

  • check if the image is up to date
  • get the image from the cache with route: http://localhost:8087/cached/<X-Hash>

You can get the image width and height with the X-Width and X-Height headers.

⚑ Examples

  • http://localhost:8087/render?text=graph%20TD;A-->B;B-->C;C-->A
  • http://localhost:8087/render?text=graph%20TD;A-->B;B-->C;C-->A&background=false
  • http://localhost:8087/render.svg?text=graph%20TD;A-->B;B-->C;C-->A
  • http://localhost:8087/render.svg?text=graph%20TD;A-->B;B-->C;C-->A&background=false
  • http://localhost:8087/render.png?text=graph%20TD;A-->B;B-->C;C-->A
  • http://localhost:8087/render.png?text=graph%20TD;A-->B;B-->C;C-->A&background=false
  • http://localhost:8087/render.jpg?text=graph%20TD;A-->B;B-->C;C-->A

⚠️ Warning

Font Awesome icons are not supported at the moment.

πŸ“Š Diagram Syntax

The chart text must be a valid Mermaid diagram.
More info here: https://mermaid-js.github.io/mermaid/

πŸ“ƒ Changelog

Please see the CHANGELOG.md for more information on what has changed recently.

πŸ… Credits

πŸ“– License

Please see the LICENSE.md file for more information.

About

Mermaid as a service

License:MIT License


Languages

Language:TypeScript 95.4%Language:Dockerfile 4.4%Language:Shell 0.2%