MCPcopy Index your code
hub / github.com/TyphonHill/go-mermaid

github.com/TyphonHill/go-mermaid @v1.0.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.0.0 ↗ · + Follow
612 symbols 2,276 edges 111 files 226 documented · 37% updated 16mo agov1.0.0 · 2025-02-28★ 431 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Go-Mermaid

example workflow Go Coverage

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.

Instalation

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

Example

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

Roadmap

Implement support for other Mermaid diagram types:

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.

Contribute

Want to help? Found a bug?

  1. Do not hesitate to fork the repository and send PRs with your changes
  2. No time to code? Open a bug/feature issue

Extension points exported contracts — how you extend this code

DiagramProperties (Interface)
(no doc) [40 implementers]
diagrams/utils/basediagram/properties.go
IDGenerator (Interface)
IDGenerator defines the interface for generating unique IDs [2 implementers]
diagrams/utils/id_generator.go
DiagramProperty (Interface)
DiagramProperty represents a configurable diagram property [1 implementers]
diagrams/utils/basediagram/properties.go

Core symbols most depended-on inside this repo

String
called by 136
diagrams/utils/basediagram/properties.go
AddAttribute
called by 67
diagrams/entityrelationship/entity.go
AddTask
called by 52
diagrams/userjourney/section.go
AddEvent
called by 47
diagrams/timeline/section.go
AddTransition
called by 31
diagrams/state/diagram.go
NewBlock
called by 30
diagrams/block/block.go
NewClass
called by 29
diagrams/class/class.go
AddState
called by 28
diagrams/state/diagram.go

Shape

Method 284
Function 243
Struct 56
TypeAlias 26
Interface 3

Languages

Go100%

Modules by API surface

diagrams/sequence/configuration_properties.go35 symbols
diagrams/userjourney/configuration_properties.go23 symbols
diagrams/state/configuration_properties.go23 symbols
diagrams/utils/basediagram/theme_properties.go22 symbols
diagrams/timeline/configuration_properties.go22 symbols
diagrams/utils/basediagram/properties.go14 symbols
diagrams/flowchart/diagram_test.go14 symbols
diagrams/class/configuration_properties.go14 symbols
diagrams/flowchart/configuration_properties.go13 symbols
diagrams/entityrelationship/configuration_properties.go12 symbols
diagrams/block/block.go12 symbols
diagrams/flowchart/diagram.go11 symbols

For agents

$ claude mcp add go-mermaid \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page