Documentation
¶
Overview ¶
Package markdown configures goldmark: CommonMark plus GFM, unique heading IDs and tryck's ::: directives.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( KindAdmonition = ast.NewNodeKind("Admonition") KindDetails = ast.NewNodeKind("Details") KindTabs = ast.NewNodeKind("Tabs") KindTab = ast.NewNodeKind("Tab") KindGenericDirective = ast.NewNodeKind("GenericDirective") )
Functions ¶
Types ¶
type Admonition ¶
type Admonition struct {
ast.BaseBlock
Variant string // note, tip, info, warning or danger
// contains filtered or unexported fields
}
Admonition is :::note, :::tip, :::info, :::warning or :::danger. The spec's Kind field is called Variant here, since goldmark nodes already have Kind and Type methods.
func (*Admonition) Dump ¶
func (n *Admonition) Dump(source []byte, level int)
func (*Admonition) Kind ¶
func (n *Admonition) Kind() ast.NodeKind
type GenericDirective ¶
GenericDirective is any directive name without a built-in renderer.
func (*GenericDirective) Dump ¶
func (n *GenericDirective) Dump(source []byte, level int)
func (*GenericDirective) Kind ¶
func (n *GenericDirective) Kind() ast.NodeKind
type Issue ¶
Issue is a problem found while parsing, located by byte offset in the parsed source (-1 if unknown).
type Options ¶
type Options struct {
// UnsafeHTML passes raw HTML in Markdown through. Otherwise it is
// replaced by an HTML comment (spec §9.4).
UnsafeHTML bool
// Extenders add goldmark extensions, such as syntax highlighting.
Extenders []plugin.MarkdownExtender
// Directives render ::: names tryck does not know, by name.
Directives map[string]plugin.DirectiveRenderer
// SitePath maps root-absolute links in RenderInline to final URLs,
// for example by adding the base path.
SitePath func(string) string
}
Options configures the Markdown processor.
type Processor ¶
type Processor struct {
// contains filtered or unexported fields
}
Processor parses and renders Markdown. It is safe for concurrent use.
func (*Processor) Parse ¶
Parse parses source into a document AST and reports directive problems and heading IDs that needed a -N suffix.
func (*Processor) RenderInline ¶
RenderInline renders a short Markdown string, such as a front matter description, and unwraps it if it is a single paragraph. Root-absolute link and image destinations ("/guide/") are passed through p.SitePath, when set, so they get the site's base path.