markdown.html.TableOfContents
type pub TableOfContentsA filter that adds IDs to headings, and optionally adds a table of contents.
Fields
maximum
let pub @maximum: IntThe maximum heading level to include.
For example, if this value is set to 3, then h4, h5 and h6 elements
are excluded from the table of contents.
class
let pub @class: StringThe class to apply to the table of contents container.
ignore_class
let pub @ignore_class: StringThe class used to mark headings such that they're not included in the table of contents.
Static methods
new
Show source codeHide source code
fn pub static new -> TableOfContents {
TableOfContents(
ids: Map.new,
tree: HeadingTree(current: Option.None, roots: []),
maximum: 6,
class: 'toc',
ignore_class: 'toc-ignore',
)
}fn pub static new -> TableOfContentsInstance methods
run
Show source codeHide source code
fn pub mut run(document: mut html.Document) {
track_headings(document)
replace_markers(document)
}fn pub mut run(document: mut Document)Transforms the HTML document.
How or what exactly this method does is up to the type that implements this trait. Examples include adding IDs to headings, generating a table of contents, or replacing one element with another.
Implemented traits
Filter
impl Filter for TableOfContents