mermaid

command module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2021 License: MIT Imports: 2 Imported by: 0

README

Mermaid

Examples

package main

import (
	"io/ioutil"

	"github.com/stornado/mermaid/pkg/mermaid"
)

func main() {
	sequenceDiagram := `
	sequenceDiagram
    participant Alice
    participant Bob
    participant John as John<br />Second Line
    Alice ->> Bob: Hello Bob, how are you?
    Bob-->>John: How about you John?
    Bob--x Alice: I am good thanks!
    Bob-x John: I am good thanks!
    Note right of John: John thinks a long<br />long time, so long<br />that the text does<br />not fit on a row.
    Bob-->Alice: Checking with John...
    Note over John:wrap: John looks like he's still thinking, so Bob prods him a bit.
    Bob-x John: Hey John - we're still waiting to know<br />how you're doing
    Note over John:nowrap: John's trying hard not to break his train of thought.
    Bob-x John:wrap: John! Are you still debating about how you're doing? How long does it take??
    Note over John: After a few more moments, John<br />finally snaps out of it.
`
	svg, png, err := mermaid.Render(sequenceDiagram)

	if err != nil {
		panic(err)
	}

	ioutil.WriteFile("mermaid.svg", []byte(svg), 0644)
	ioutil.WriteFile("mermaid.png", png, 0644)
}

License

MIT

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

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