Use document heading numbering in HTML previews and exports - #60
Open
PiotrCzapla wants to merge 4 commits into
Open
Use document heading numbering in HTML previews and exports#60PiotrCzapla wants to merge 4 commits into
PiotrCzapla wants to merge 4 commits into
Conversation
PiotrCzapla
force-pushed
the
title-numbering-boundary
branch
from
September 3, 2026 20:51
634c419 to
db57d22
Compare
PiotrCzapla
force-pushed
the
frontmatter-numbering
branch
from
September 3, 2026 20:58
ad0cf5f to
a1069e2
Compare
… numbers on request A document's frontmatter `number_headings: legal` (or `decimal`) now drives every exporter when the call gives no scheme: `mdhtml2html` and `mdhtml2typst` read it from the `Mdhtml` result's `meta`, `md2gfm` extracts it from the raw source by the dialect's own rule (new native `frontmatter_meta`), and `viewmd` reads a notebook's frontmatter message through fastcore's `nb_frontmatter` since `dlg2md` fences that raw cell as code. The call argument still wins when both are present. `refs='ids'` (the live-preview mode Solveit renders in) used to skip numbering entirely; a requested scheme now numbers the fragment's headings there too, while nothing numbers automatically without a registry. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
PiotrCzapla
force-pushed
the
title-numbering-boundary
branch
from
September 3, 2026 21:01
db57d22 to
48954ee
Compare
PiotrCzapla
force-pushed
the
frontmatter-numbering
branch
from
September 3, 2026 21:01
a1069e2 to
46493bc
Compare
PiotrCzapla
marked this pull request as ready for review
September 7, 2026 11:38
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I hope that the ipynb could become a file format that can independently be rendered to docx, pdf & html without needing to specify anything else than the file on the command line, and eventually in solveit.
This PR is the first step. Frontmatter in ipynb has a place where one can store what numbering scheme should be used.
LLM text below:
A document should carry its heading-numbering choice into HTML. Running
md2htmlon a contract that declares legal numbering should produce numbered clauses without a separate numbering option.For example, put this at the start of the document:
Run
md2html contract.md --frontmatter. It uses that setting to display1. Paymentand(a) Due date. The document title stays unnumbered. Usedecimalfor decimal numbering. An explicit numbering option overrides the document's setting.The exporter reads the setting from the parsed document. HTML previews also number headings when references display target names instead of clause numbers. Previously, that preview mode skipped heading numbering altogether.
The same frontmatter setting also applies to notebook browser previews, GFM, and Typst export. PDF command-line support is separate work.
Tests cover the document setting, explicit overrides, invalid schemes, preview numbering, GFM, Typst, and notebook previews. The original test report records 930 passing tests and one failure attributed to a missing optional dependency. It also records passing Rust tests. I have not rerun that full suite for this description update.
Original attribution:
🤖 Generated with Claude Code & Astra