Skip to content
This repository has been archived by the owner on Aug 5, 2020. It is now read-only.

Latest commit

 

History

History
45 lines (32 loc) · 631 Bytes

README.md

File metadata and controls

45 lines (32 loc) · 631 Bytes

mermaid-go

mermaid-js executable written in go

uses chromedp to run mermaid js.

Use

CLI

Installation

go get -u github.com/joshcarp/mermaid-go

Execute

mermaid-go <input.mmdc> -o <output.svg>

See demo

As a go package

go get -u github.com/joshcarp/mermaid-go/mermaid

package main

import (
	"io/ioutil"

	"github.com/joshcarp/mermaid-go/mermaid"
)

func main() {
	str := `
graph TD;
A-->B;
A-->C;
B-->D;
C-->D;
	`
	svg := mermaid.Execute(str)
	if err := ioutil.WriteFile("mermaid.svg", []byte(svg), 0644); err != nil {
		panic(err)
	}
}