Skip to main content

Module html

Module html 

Source
Expand description

The stylesheet of the toc feature on the html backend, flm.toc.style (stylesheet), and the markup it selects on.

On the HTML page the table of contents is written with the same presentation elements as on every other output (rules), and the HTML backend writes them as its HTML contract states (see CONVENTIONS): the block of role flm.toc is a <nav> carrying the role doc-toc, each list a <ul>, each entry an <li> holding the link to its heading, the number in a span of role flm.toc.entry.number. Each <li> carries its heading’s level as data-flm-level, the attribute the heading itself carries, so that one selector [data-flm-level="N"] matches the headings of level N and their entries. For \section{One}\subsection{Two} under numbering:

<nav class="flm-pres-block flm-toc" role="doc-toc" data-flm-kind="toc">
  <ul class="flm-pres-list" data-flm-kind="unnumbered toc">
    <li data-flm-level="1"><a class="flm-pres-link" href="#sec--One" data-flm-kind="toc"><span class="flm-pres-span flm-toc-entry-number">1</span> One</a>
      <ul class="flm-pres-list" data-flm-kind="unnumbered toc">
        <li data-flm-level="2"><a class="flm-pres-link" href="#sec--Two" data-flm-kind="toc"><span class="flm-pres-span flm-toc-entry-number">1.1</span> Two</a></li>
      </ul>
    </li>
  </ul>
</nav>

The general rule of the root (RootRule) requires the feature’s style identifier STYLE (flm.toc.style), which on this backend names the stylesheet: one cascade layer that removes the list markers, indents each nested list and leaves a space below the table, the indentation and the space custom properties it declares (--flm-toc-indent, --flm-toc-space-below). It sets structure only; a page that wants another presentation adds a stylesheet of its own, or replaces this one through the render option definitions.

Functions§

stylesheet
The feature’s style definition, flm.toc.style (STYLE): the lists without a marker, each nested list indented and a space below the table, in one cascade layer, with the indentation and the space custom properties it declares (--flm-toc-indent, --flm-toc-space-below). The space after an entry’s number is text the entry’s rule writes, not a rule of the stylesheet. See the module documentation.