Documentation
¶
Overview ¶
Package pikchr adds support for Pikchr diagrams to the Goldmark Markdown parser.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Kind = ast.NewNodeKind("PikchrBlock")
Kind is the kind of a Pikchr block.
var ScriptKind = ast.NewNodeKind("PikchrScriptBlock")
ScriptKind is the kind of a Pikchr Script block.
Functions ¶
This section is empty.
Types ¶
type Block ¶
type Block struct { ast.FencedCodeBlock // contains filtered or unexported fields }
Block is a Pikchr block.
```pikchr box color red wid 2.6in \ "Click on any diagram on this page" big \ "to see the Pikchr source text" big ```
Its raw contents are the plain text of the Pikchr diagram.
type Extender ¶
type Extender struct { ToggleDefault bool // If true, turn toggling on by default LimitWidthDefault bool // If true, turn limitwidth on by default }
Extender adds support for Pikchr diagrams to a Goldmark Markdown parser.
Use it by installing it to the goldmark.Markdown object upon creation.
goldmark.New( // ... goldmark.WithExtensions( // ... &pikchr.Exender{}, ), )
type ImmutableAttributes ¶
type ImmutableAttributes interface { // Get returns (value, true) if an attribute associated with given // name exists, otherwise (nil, false) Get(name []byte) (interface{}, bool) // GetString returns (value, true) if an attribute associated with given // name exists, otherwise (nil, false) GetString(name string) (interface{}, bool) // All returns all attributes. All() []ast.Attribute }
ImmutableAttributes is a read-only interface for ast.Attributes.
type Renderer ¶
type Renderer struct { ToggleDefault bool // If true, turn toggling on by default LimitWidthDefault bool // If true, turn limitwidth on by default }
Renderer renders Pikchr diagrams as HTML/SVG.
func (*Renderer) RegisterFuncs ¶
func (r *Renderer) RegisterFuncs(reg renderer.NodeRendererFuncRegisterer)
RegisterFuncs registers the renderer for Pikchr blocks with the provided Goldmark Registerer.
type ScriptBlock ¶
ScriptBlock marks where the Pikchr Javascript will be included.
This is a placeholder and does not contain anything.
func (*ScriptBlock) Dump ¶
func (b *ScriptBlock) Dump(src []byte, level int)
Dump dumps the contents of this block to stdout.
func (*ScriptBlock) IsRaw ¶
func (*ScriptBlock) IsRaw() bool
IsRaw reports that this block should be rendered as-is.
func (*ScriptBlock) Kind ¶
func (*ScriptBlock) Kind() ast.NodeKind
Kind reports that this is a PikchrScriptBlock.
type Transformer ¶
type Transformer struct { }
Transformer transforms a Goldmark Markdown AST with support for Pikchr diagrams. It makes the following transformations:
- replace pikchr code blocks with pikchr.Block nodes
- add a pikchr.ScriptBlock node if the document uses Pikchr