Documentation
¶
Overview ¶
Package superscript provides a Goldmark extension for rendering superscripts using single-caret syntax.
This extension allows content between single carets (^text^) to be rendered as HTML superscripts (<sup>text</sup>).
Usage:
md := goldmark.New( goldmark.WithExtensions( superscript.NewSuperscript(), ), )
The extension follows these parsing rules:
- Superscripts must not start at the beginning of a line or after whitespace
- Content between carets cannot contain spaces or additional carets
- Empty superscripts (^^ with no content) are not parsed as superscripts
Index ¶
Constants ¶
This section is empty.
Variables ¶
var KindSuperscript = ast.NewNodeKind("Superscript")
KindSuperscript is a NodeKind of the Superscript node.
var Superscript = NewSuperscript()
Superscript is a pre-configured superscript extension instance.
var SuperscriptAttributeFilter = html.GlobalAttributeFilter
SuperscriptAttributeFilter defines attribute names which superscript elements can have. Uses the global HTML attribute filter for consistency with other HTML elements.
Functions ¶
func NewSuperscript ¶
func NewSuperscript(opts ...SuperscriptOption) *superscript
NewSuperscript creates a new superscript extension with the given options.
func NewSuperscriptHTMLRenderer ¶
func NewSuperscriptHTMLRenderer(opts ...html.Option) renderer.NodeRenderer
NewSuperscriptHTMLRenderer returns a new SuperscriptHTMLRenderer with the given options.
func NewSuperscriptParser ¶
func NewSuperscriptParser() parser.InlineParser
NewSuperscriptParser returns a new InlineParser that parses superscript expressions.
Types ¶
type Node ¶
type Node struct {
ast.BaseInline
}
Node represents a superscript node in the AST.
func NewSuperscriptNode ¶
func NewSuperscriptNode() *Node
NewSuperscriptNode returns a new Superscript node.
type SuperscriptHTMLRenderer ¶
SuperscriptHTMLRenderer renders superscript nodes as HTML <sup> elements.
func (*SuperscriptHTMLRenderer) RegisterFuncs ¶
func (r *SuperscriptHTMLRenderer) RegisterFuncs(reg renderer.NodeRendererFuncRegisterer)
RegisterFuncs implements renderer.NodeRenderer.RegisterFuncs.
type SuperscriptOption ¶
type SuperscriptOption func(*superscript)
SuperscriptOption configures the superscript extension.