mermaid

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 31, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateMermaid

func GenerateMermaid(config *configuration.Config, setting *Mermaid) (string, error)

GenerateMermaid creates a Mermaid diagram from the config and mermaid settings. When a subgraph query is provided, nodes that have a parent will be placed inside the nearest explicit (query–matched) ancestor.

Types

type LinkStyle

type LinkStyle struct {
	// The query to identify links to format with the style
	Filters []query.Filter `yaml:"filters"`
	// The style to apply to the links
	Format LinkStyleFormat `yaml:"format"`
}

func (*LinkStyle) Validate

func (l *LinkStyle) Validate() error

type LinkStyleFormat

type LinkStyleFormat struct {
	Stroke      string `yaml:"stroke,omitempty"`
	StrokeWidth string `yaml:"stroke-width,omitempty"`
}

func (*LinkStyleFormat) Validate

func (l *LinkStyleFormat) Validate() error

type Mermaid

type Mermaid struct {
	// The direction of the flowchart (TB, TD, BT, RL, LR)
	Direction string `yaml:"direction"`
	// The attribute to use as the node label (if set)
	NodeLabel string `yaml:"nodeLabel"`
	// The query to identify nodes to treat as subgraphs (explicit containers)
	SubgraphNodes query.Nodes `yaml:"subgraphNodes,omitempty"`
	// The style to apply to nodes
	NodeStyle []NodeStyle `yaml:"nodeStyles,omitempty"`
	// The style to apply to links
	LinkStyle []LinkStyle `yaml:"linkStyles,omitempty"`
}

Mermaid contains the settings for generating the diagram.

func LoadMermaid

func LoadMermaid(filePath string) (*Mermaid, error)

LoadMermaid loads and parses a single YAML mermaid setting file from the given path.

func ParseYAML

func ParseYAML(content string) (*Mermaid, error)

ParseYAML parses the YAML content into a Mermaid

func (*Mermaid) Validate

func (m *Mermaid) Validate() error

Validate checks if the mermaid is valid.

type NodeStyle

type NodeStyle struct {
	// The query to identify nodes to format with the style
	Filters []query.Filter `yaml:"filters"`
	// The style to apply to the nodes
	Format NodeStyleFormat `yaml:"format"`
}

func (*NodeStyle) Validate

func (n *NodeStyle) Validate() error

type NodeStyleFormat

type NodeStyleFormat struct {
	Fill        string `yaml:"fill,omitempty"`
	Color       string `yaml:"color,omitempty"`
	StrokeWidth string `yaml:"stroke-width,omitempty"`
	FontSize    string `yaml:"font-size,omitempty"`
	Padding     string `yaml:"padding,omitempty"`
	Rx          string `yaml:"rx,omitempty"`
	Ry          string `yaml:"ry,omitempty"`
}

func (*NodeStyleFormat) Validate

func (n *NodeStyleFormat) Validate() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL