Search results

There are no results.

markdown.html.TableOfContents

class pub TableOfContents

A filter that adds IDs to headings, and optionally adds a table of contents.

Fields

maximum

let pub @maximum: Int

The 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: String

The class to apply to the table of contents container.

ignore_class

let pub @ignore_class: String

The class used to mark headings such that they're not included in the table of contents.

Static methods

new

Show source code
Hide 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 -> TableOfContents

Instance methods

run

Show source code
Hide 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

markdown.html.

Filter

impl Filter for TableOfContents