Documentation
¶
Overview ¶
Package genericdirective is the goldmark side of site- and theme-authored generic directives (internal/directive): one block parser and renderer handle every registered ::: directive, dispatching on the fence name.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var KindGenericDirective = gast.NewNodeKind("GenericDirective")
Functions ¶
func NewParser ¶
func NewParser(registry *directive.Registry) parser.BlockParser
NewParser returns a block parser dispatching on registry names. It declines unregistered names so unknown ::: fences fall through as plain text, and it registers after every built-in parser, so built-ins always win their names.
func NewRenderer ¶
func NewRenderer(registry *directive.Registry, inner gmrenderer.Renderer) gmrenderer.NodeRenderer
NewRenderer returns a node renderer for generic directive blocks.
Types ¶
type Extension ¶
Extension registers the generic directive parser and renderer. It must be added AFTER every built-in extension: same-trigger block parsers run in registration order, which is what lets built-ins win name conflicts.
type Node ¶
type Node struct {
gast.BaseBlock
Name string
Label string
Attrs map[string]string
RawBody string
// SourceStart and SourceStop bound the raw body of a container directive in
// the document source. SourceStop stays 0 when the fence is never closed.
SourceStart int
SourceStop int
}
Node is a parsed generic directive block. Container directives carry their body as parsed children and record where its raw Markdown sits; leaf directives capture the body verbatim in RawBody.