mdt

package
v0.0.0-...-711dd2b Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyWraps

func ApplyWraps(source []byte, wraps []*FenceWrap) []byte

Types

type Block

type Block struct {
	XMLName xml.Name
	Class   string `xml:"class,attr"`
	Img     Img    `xml:"summary>img"`
	Code    Code   `xml:"p"`
}

func NewBlock

func NewBlock(mermaid []byte, src string) Block

func (*Block) SetMermaid

func (b *Block) SetMermaid(mermaid []byte)

func (*Block) SetSrc

func (b *Block) SetSrc(src string)

type Code

type Code struct {
	Code    string `xml:",innerxml"`
	Mermaid []byte `xml:"-"`
}

type Fence

type Fence struct {
	Segment text.Segment
	Mermaid []byte
}

func ParseFences

func ParseFences(source []byte, root ast.Node) ([]*Fence, error)

func (*Fence) Content

func (f *Fence) Content() []byte

Content returns the content inside the fences

func (*Fence) Slice

func (f *Fence) Slice() text.Segment

type FenceWrap

type FenceWrap struct {
	Segment text.Segment
	Block   Block
}

func ParseWrappedFences

func ParseWrappedFences(source []byte, root ast.Node) ([]*FenceWrap, error)

func (*FenceWrap) Marshal

func (b *FenceWrap) Marshal() []byte

func (*FenceWrap) Slice

func (b *FenceWrap) Slice() text.Segment

type Img

type Img struct {
	Src string `xml:"src,attr"`
}

type InkInput

type InkInput struct {
	Code          string `json:"code"`
	Mermaid       string `json:"mermaid"`
	UpdateEditor  bool   `json:"updateEditor"`
	AutoSync      bool   `json:"autoSync"`
	UpdateDiagram bool   `json:"updateDiagram"`
}

type MermaidInk

type MermaidInk struct {
	BaseURL string
	Config  InkInput
}

func NewMermaidInk

func NewMermaidInk() *MermaidInk

func (*MermaidInk) Encode

func (ink *MermaidInk) Encode(code []byte) (string, error)

func (*MermaidInk) Update

func (ink *MermaidInk) Update(f *FenceWrap) error

func (*MermaidInk) UpdateAll

func (ink *MermaidInk) UpdateAll(wraps []*FenceWrap) error

func (*MermaidInk) Wrap

func (ink *MermaidInk) Wrap(f *Fence) (*FenceWrap, error)

func (*MermaidInk) WrapAll

func (ink *MermaidInk) WrapAll(fences []*Fence) ([]*FenceWrap, error)

Jump to

Keyboard shortcuts

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