Go-Mermaid is an open-source Go language (Golang) project designed to streamline and automate the creation of Mermaid diagrams.
Mermaid is a popular diagramming and charting tool that uses a simple and intuitive text-based syntax to generate a wide variety of diagrams, including flowcharts, sequence diagrams, Gantt charts, and more.
Go-Mermaid is tailored for automation and batch diagram generation, making it an ideal choice for projects where numerous diagrams need to be created or updated consistently. Whether you're a developer, a system architect, or a documentation enthusiast, Go-Mermaid empowers you to automate the creation of Mermaid diagrams with efficiency and precision.
go get -u github.com/TyphonHill/go-mermaid
All examples are available here
package main
import (
"fmt"
"github.com/TyphonHill/go-mermaid/flowchart"
)
func main() {
fc := flowchart.NewFlowchart()
fc.Title = "Simple Flowchart"
node1 := fc.AddNode("Start")
node2 := fc.AddNode("End")
link := fc.AddLink(node1, node2)
link.Shape = flowchart.LinkShapeDotted
fmt.Println(fc.String())
}
The example above creates the following diagram:
---
title: Simple Flowchart
---
flowchart TB
0("Start")
1("End")
0 -.-> 1
Implement support for other Mermaid diagram types:
- Flowchart
- Class Diagram
- Sequence Diagram
- State Diagram
- Entity Relationship Diagrams
- User Journey Diagram
- Timeline Diagram
- Block Diagram
- Gantt Diagram
- Pie Chart
- Quadrant Chart
- Requirement Diagram
Mermaid supports other diagram types that are currently marked as "experimental" and as such, are subject to change. Once these diagrams leave the experimental phase, they can be added to the list above.
Want to help? Found a bug?
- Do not hesitate to fork the repository and send PRs with your changes
- No time to code? Open a bug/feature issue