mermaid

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2021 License: MIT Imports: 8 Imported by: 1

README

goldmark-mermaid

Sync to Gitee w orkflow state codecov version

goldmark-mermaid is an extension for goldmark.

You can use mermaid to build svg image in your markdown like mume

screenshot

There are two demo(using ' instead of ′ in the code block)

  1. default config

Demo1 Output1

'''go
package main

import ()

func main(){}
'''

'''mermaid
pie
    title Key elements in Product X
    "Calcium" : 42.96
    "Potassium" : 50.05
    "Magnesium" : 10.01
    "Iron" :  5
'''

  1. using mermaid-svg and goldmark-highlighting extension

Demo2 Output2

'''go
package main

import ()

func main(){}
'''

'''mermaid-svg
pie
    title Key elements in Product X
    "Calcium" : 42.96
    "Potassium" : 50.05
    "Magnesium" : 10.01
    "Iron" :  5
'''

Installation

go get -u github.com/OhYee/goldmark-mermaid

License

MIT

Documentation

Overview

Package mermaid is a extension for the goldmark(http://github.com/yuin/goldmark).

This extension adds svg picture output from mermaid language using go-mermaid(https://github.com/OhYee/go-mermaid).

Index

Constants

This section is empty.

Variables

View Source
var Default = NewMermaidExtension(50, "mermaid")

Default Mermaid extension when there is no other fencedCodeBlock goldmark render extensions

Functions

func NewMermaidExtension

func NewMermaidExtension(length int, languages ...string) goldmark.Extender

NewMermaidExtension return the goldmark.Extender

func RenderMap

func RenderMap(length int, languages ...string) ext.RenderMap

RenderMap return the goldmark-fenced_codeblock_extension.RenderMap

Types

type Mermaid

type Mermaid struct {
	Languages []string

	MaxLength int
	// contains filtered or unexported fields
}

Mermaid render struct

func NewMermaid

func NewMermaid(length int, languages ...string) *Mermaid

NewMermaid initial a Mermaid struct

func (*Mermaid) Renderer

func (u *Mermaid) Renderer(w util.BufWriter, source []byte, node ast.Node, entering bool) (ast.WalkStatus, error)

Renderer render function

Directories

Path Synopsis
demo

Jump to

Keyboard shortcuts

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