Categorygithub.com/andre-a-alves/flowchart
repositorypackage
0.1.0-beta.1
Repository: https://github.com/andre-a-alves/flowchart.git
Documentation: pkg.go.dev

# README

Flowchart Modeling in Go

GitHub License GitHub Tag

Flowchart is a Go package designed to model flowcharts with support for various node types, link styles, and subgraphs. Currently, the package can export flowcharts in Mermaid syntax, with plans for additional export options in the future.

Features

  • Node Types: Various node types like process, decision, database, and more.
  • Link Styles: Support for different line styles such as solid, dotted, thick, and no-line.
  • Arrow Types: Add arrows to the origin, target, or both sides of a link.
  • Subgraphs: Create subgraphs to organize your flowchart hierarchically.
  • Flowchart Directions: Control the flow direction, including left-to-right, right-to-left, or top-to-bottom.
  • Mermaid Export: Generate Mermaid syntax to easily visualize flowcharts.

Installation

To install the package, run:

go get github.com/andre-a-alves/flowchart

Example Usage

package main

import (
	"fmt"
	
	"github.com/andre-a-alves/flowchart"
)

func main() {
	// Create nodes
	processNode := flowchart.ProcessNode("Process1", nil)
	decisionNode := flowchart.DecisionNode("Decision1", nil)

	// Create a solid link between nodes
	link := flowchart.SolidLink(processNode, decisionNode, nil)

	// Create flowchart and add nodes and links
	chart := flowchart.VerticalFlowchart(nil)
	chart.AddNode(processNode)
	chart.AddNode(decisionNode)
	chart.AddLink(link)

	// Output Mermaid syntax
	fmt.Println(flowchart.RenderMermaid(chart))
}

Future Plans

  • Support for additional diagram formats (e.g., Graphviz, PlantUML)
  • Improved node and link customization options
  • More advanced flowchart layout controls

License

This project is licensed under the Apache 2.0 License. See the LICENSE file for more details.