Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultConfig = Config{ StartLevel: 2, EndLevel: 3, Ordered: false, }
DefaultConfig is the default ToC configuration.
View Source
var Empty = &Fragments{ Headings: Headings{}, HeadingsMap: map[string]*Heading{}, }
Empty is an empty ToC.
Functions ¶
This section is empty.
Types ¶
type Builder ¶ added in v0.111.0
type Builder struct {
// contains filtered or unexported fields
}
Builder is used to build the ToC data structure.
type Config ¶
type Config struct { // Heading start level to include in the table of contents, starting // at h1 (inclusive). // <docsmeta>{ "identifiers": ["h1"] }</docsmeta> StartLevel int // Heading end level, inclusive, to include in the table of contents. // Default is 3, a value of -1 will include everything. EndLevel int // Whether to produce a ordered list or not. Ordered bool }
type Fragments ¶ added in v0.111.0
type Fragments struct { // Headings holds the top level headings. Headings Headings // Identifiers holds all the identifiers in the ToC as a sorted slice. // Note that collections.SortedStringSlice has both a Contains and Count method // that can be used to identify missing and duplicate IDs. Identifiers collections.SortedStringSlice // HeadingsMap holds all the headings in the ToC as a map. // Note that with duplicate IDs, the last one will win. HeadingsMap map[string]*Heading }
Fragments holds the table of contents for a page.
Click to show internal directories.
Click to hide internal directories.