genericdirective

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2026 License: MIT Imports: 15 Imported by: 0

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

View Source
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

type Extension struct {
	Registry *directive.Registry
}

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.

func (*Extension) Extend

func (e *Extension) Extend(m goldmark.Markdown)

type Node

type Node struct {
	gast.BaseBlock
	Name    string
	Label   string
	Attrs   map[string]string
	RawBody string
}

Node is a parsed generic directive block. Container directives carry their body as parsed children; leaf directives capture it verbatim in RawBody.

func (*Node) Dump

func (n *Node) Dump(source []byte, level int)

func (*Node) Kind

func (n *Node) Kind() gast.NodeKind

Jump to

Keyboard shortcuts

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