Help us shape the future of Go! Take the 2026 Go Developer Survey

footnote

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Footnote = &footnote{
	options: []FootnoteOption{},
}

Footnote is an extension that allow you to use PHP Markdown Extra Footnotes.

Functions

func NewFootnote

func NewFootnote(opts ...FootnoteOption) goldmark.Extender

NewFootnote returns a new extension with given options.

func NewFootnoteASTTransformer

func NewFootnoteASTTransformer() parser.ASTTransformer

NewFootnoteASTTransformer returns a new parser.ASTTransformer that insert a footnote list to the last of the document.

func NewFootnoteBlockParser

func NewFootnoteBlockParser() parser.BlockParser

NewFootnoteBlockParser returns a new parser.BlockParser that can parse footnotes of the Markdown(PHP Markdown Extra) text.

func NewFootnoteHTMLRenderer

func NewFootnoteHTMLRenderer(opts ...FootnoteOption) renderer.NodeRenderer

NewFootnoteHTMLRenderer returns a new FootnoteHTMLRenderer.

func NewFootnoteParser

func NewFootnoteParser() parser.InlineParser

NewFootnoteParser returns a new parser.InlineParser that can parse footnote links of the Markdown(PHP Markdown Extra) text.

Types

type FootnoteConfig

type FootnoteConfig struct {
	html.Config

	// IDPrefix is a prefix for the id attributes generated by footnotes.
	IDPrefix []byte

	// IDPrefix is a function that determines the id attribute for given Node.
	IDPrefixFunction func(gast.Node) []byte

	// LinkTitle is an optional title attribute for footnote links.
	LinkTitle []byte

	// BacklinkTitle is an optional title attribute for footnote backlinks.
	BacklinkTitle []byte

	// LinkClass is a class for footnote links.
	LinkClass []byte

	// BacklinkClass is a class for footnote backlinks.
	BacklinkClass []byte

	// BacklinkHTML is an HTML content for footnote backlinks.
	BacklinkHTML []byte
}

FootnoteConfig holds configuration values for the footnote extension.

Link* and Backlink* configurations have some variables: Occurrences of “^^” in the string will be replaced by the corresponding footnote number in the HTML output. Occurrences of “%%” will be replaced by a number for the reference (footnotes can have multiple references).

func NewFootnoteConfig

func NewFootnoteConfig() FootnoteConfig

NewFootnoteConfig returns a new Config with defaults.

func (*FootnoteConfig) SetOption

func (c *FootnoteConfig) SetOption(name renderer.OptionName, value interface{})

SetOption implements renderer.SetOptioner.

type FootnoteHTMLRenderer

type FootnoteHTMLRenderer struct {
	FootnoteConfig
}

FootnoteHTMLRenderer is a renderer.NodeRenderer implementation that renders FootnoteLink nodes.

func (*FootnoteHTMLRenderer) RegisterFuncs

RegisterFuncs implements renderer.NodeRenderer.RegisterFuncs.

type FootnoteOption

type FootnoteOption interface {
	renderer.Option
	// SetFootnoteOption sets given option to the extension.
	SetFootnoteOption(*FootnoteConfig)
}

FootnoteOption interface is a functional option interface for the extension.

func WithFootnoteBacklinkClass

func WithFootnoteBacklinkClass[T []byte | string](a T) FootnoteOption

WithFootnoteBacklinkClass is a functional option that is a class for footnote backlinks.

func WithFootnoteBacklinkHTML

func WithFootnoteBacklinkHTML[T []byte | string](a T) FootnoteOption

WithFootnoteBacklinkHTML is an HTML content for footnote backlinks.

func WithFootnoteBacklinkTitle

func WithFootnoteBacklinkTitle[T []byte | string](a T) FootnoteOption

WithFootnoteBacklinkTitle is a functional option that is an optional title attribute for footnote backlinks.

func WithFootnoteHTMLOptions

func WithFootnoteHTMLOptions(opts ...html.Option) FootnoteOption

WithFootnoteHTMLOptions is functional option that wraps goldmark HTMLRenderer options.

func WithFootnoteIDPrefix

func WithFootnoteIDPrefix[T []byte | string](a T) FootnoteOption

WithFootnoteIDPrefix is a functional option that is a prefix for the id attributes generated by footnotes.

func WithFootnoteIDPrefixFunction

func WithFootnoteIDPrefixFunction(a func(gast.Node) []byte) FootnoteOption

WithFootnoteIDPrefixFunction is a functional option that is a prefix for the id attributes generated by footnotes.

func WithFootnoteLinkClass

func WithFootnoteLinkClass[T []byte | string](a T) FootnoteOption

WithFootnoteLinkClass is a functional option that is a class for footnote links.

func WithFootnoteLinkTitle

func WithFootnoteLinkTitle[T []byte | string](a T) FootnoteOption

WithFootnoteLinkTitle is a functional option that is an optional title attribute for footnote links.

Jump to

Keyboard shortcuts

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