Headings¶
prodockit.headings numbers the headings in your document as sections,
such as 1, 1.1, and 1.2. The numbers update automatically when you add,
remove, or move a heading.
Use it when your document needs numbered sections. Add Cross-references when you also want to link readers to those sections by number and name.
Enable the extension¶
Enable it in zensical.toml:
continuous carries the numbering across the pages in your Zensical
navigation. Use per-document instead when every page should start again at
section 1.
Number headings¶
Each # heading starts a main section (1, 2, and so on). A ## heading
starts a section inside it (1.1, 1.2, and so on):
The extension calculates the section numbers, but it does not add them to the visible heading text on the website. Cross-references uses the calculated numbers in links such as “1.1 Background”.
Why the heading itself does not visibly change
The section numbers appear in Cross-references, rather than next to the website's heading text.
Configure headings¶
Choose how numbering continues¶
The numbering setting accepts two values:
| Value | Result |
|---|---|
"continuous" |
Continue the main section numbers across pages in Zensical navigation order. |
"per-document" |
Start each page's main section numbering at 1. This is the extension's default. |
For a multi-page documentation site, set the option in zensical.toml:
For example, if one page ends at section 3, the next page starts at section 4. This also lets Cross-references show one consistent set of section numbers across the site.
Number appendices¶
Add is_appendix: true to the settings at the top of the page (its
front matter) to use letter-based numbering instead of the normal
numeric sequence - "A", "A.1",
"A.1.1" - once you've enabled
continuous numbering (see
Reference below). An appendix page doesn't consume a number from the
numeric sequence at all, so pages after it aren't left with a gap. Letters
are assigned sequentially in nav order - the first is_appendix page
becomes "A", the second "B", and so on, independent of how many
numbered pages come before them.
For example:
a prodockit.refs reference to Terms from another page:
renders to (a link to glossary.md#terms, shown here as a code block
since glossary.md isn't a real page on this site):
Glossary's own h1 becomes "A" (the first appendix page in nav) and
its Terms subheading becomes "A.1" - and References, the page after
it, still gets the next plain number in the numeric sequence ("2", not
"3"), exactly as if the appendix page had never consumed one. Only
meaningful under Zensical; ignored otherwise.
Leave a heading unnumbered¶
A heading with an unnumbered class - e.g. a cover page or title slide -
still gets an id, but is skipped when computing section numbers, so it
doesn't consume a counter position:
Introduction above is still numbered 1, as if Cover Page weren't
there at all.
Hide a heading from PDF navigation¶
A PDF built by prodockit.pdf has two tables of contents, and
unnumbered alone only reaches one of them:
- The generated Table of Contents page, built from every heading
Pandoc sees. Add
unlistedto also keep a heading off this page - it still keeps itsidand number (if any), the same asunnumberedabove. Pandoc itself defines this class and honours it viapandoc.structure.table_of_contents(); prodockit doesn't add or change its meaning. - The bookmark outline - the navigation pane a PDF reader shows down
the side. This is built separately by WeasyPrint from every
h1-h6in the document, andunlistedhas no effect on it at all. Addunbookmarkedto also remove a heading from the outline.
This distinction matters because outline nesting follows heading level:
an unlisted (but not unbookmarked) h1 still becomes a top-level
outline node, and every following heading of lower level nests underneath
it instead of under its real chapter - not just one stray entry, but a
misnested chunk of the outline. See
Table of contents and bookmark outline
for the underlying stylesheet rule and worked example.
Reference¶
Ids¶
An id comes from one of, in order of precedence:
- An explicit id set via
attr_list, e.g.# Introduction {: #custom-id }. - Python-Markdown's own
tocextension, whichprodockit.headingsenables automatically (with its defaults) if you haven't already enabled it yourself - so if you have configuredtoc(e.g. withpermalink: true), that configuration is left untouched and reused. - A minimal built-in slugify fallback, used only if
tocis somehow not registered at all (this should not normally happen, sinceprodockit.headingsenables it).
Zensical settings¶
| Setting | Default | What it controls |
|---|---|---|
numbering |
"per-document" |
Use "continuous" to carry main section numbers across pages in Zensical navigation order. |
appendix_attr |
"is_appendix" |
Name of the front matter setting that marks an appendix page. Change this only if your project uses another name. |
source |
"" (detected automatically) |
Advanced: identifies the current page when using the extension outside Zensical. Leave it unset in zensical.toml. |
Cross-page numbering in Zensical¶
Zensical shares heading information across the complete navigation
automatically. With numbering = "continuous", adding or reordering a page
updates later section numbers without a manual starting value.
Give repeated headings explicit ids. If several pages each contain ## Quick
start, their automatically generated ids collide and the build warns; which
page renders first is not a stable way to choose a link target:
For integration with another Markdown renderer, see Extension integration.
Customise with a CSS style sheet¶
prodockit.headings doesn't add any class of its own to a heading - only an
id (see above), the class(es) already on the heading (e.g. unnumbered),
and whatever numbers are consumed by prodockit.refs. There is no
prodockit-heading-style class to hook a stylesheet onto directly.