Awesome
mermaid.go
mermaid.go is a library for invoking mermaid.js and getting rending result.
sequenceDiagram
Actor A as User
participant B as mermaid.go
participant C as chromedp
A ->>+ B: NewRenderEngine()
B ->>+ C: Lanch new instance of chrome and eval JS library
C -->> B:
B -->> A:
loop Render Process
A ->> B: Render()
B ->> C: mermaid.render()
C ->> B: { svg, boxModel, exceptions }
B ->> A: Result{ Svg, BoxModel Error }
end
A ->> B: Cancel()
B -->> C: Context done
C -->>- C: Shutdown chrome instance
B -->>- A:
Installation:
go get -u github.com/dreampuf/mermaid.go
Example:
An example is available here.
How to build
- Checkout the code base
git clone https://github.com/dreampuf/mermaid.go.git
- Fetch the latest version of mermaid.js
curl -LO https://unpkg.com/mermaid/dist/mermaid.min.js
Or if you want a specific versioncurl -LO https://unpkg.com/mermaid@10.3.0/dist/mermaid.min.js
- Test it
go test ./...
License
- mermaid.go: MIT License
- mermaid.js: MIT License
- chromedp: MIT License