Skip to content

Frontmatter number_headings selects the heading numbering; refs='ids' numbers on request - #60

Draft
PiotrCzapla wants to merge 1 commit into
title-numbering-boundaryfrom
frontmatter-numbering
Draft

Frontmatter number_headings selects the heading numbering; refs='ids' numbers on request#60
PiotrCzapla wants to merge 1 commit into
title-numbering-boundaryfrom
frontmatter-numbering

Conversation

@PiotrCzapla

Copy link
Copy Markdown
Contributor

Stacked on #59 (the h1 title boundary); the base flips to main once that merges.

What changes

  • A document's frontmatter number_headings: legal (or decimal) selects the heading numbering whenever a 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 frontmatter rule (new native frontmatter_meta). The call argument still wins when both are present. A plain string source carries no meta, so nothing changes for callers passing raw MDHTML.
  • 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; nothing numbers automatically without a registry, as before.
  • viewmd on a notebook reads the frontmatter message through fastcore's nb_frontmatter, since dlg2md fences that raw cell as code and the parser never sees it. viewmd rspa.ipynb therefore numbers the whole contract with the scheme the dialog declares.
  • README and DIALECT.md document the key; md2html/viewmd help text says the default is the frontmatter's scheme.

Tests

test_frontmatter_selects_numbering covers the HTML fallback, argument precedence, the bare-string case, an unknown scheme name raising, ids mode numbering on request and never automatically, GFM, and Typst. The viewmd test gains a notebook whose raw frontmatter cell names the scheme. Full suite: 930 passed (the one failure, test_math_callbacks_with_math_core, is the pre-existing missing optional dependency). cargo test, cargo fmt, and chkstyle clean apart from the pre-existing note in chunk.py.

🤖 Generated with Claude Code

@PiotrCzapla
PiotrCzapla force-pushed the title-numbering-boundary branch from 634c419 to db57d22 Compare September 3, 2026 20:51
@PiotrCzapla
PiotrCzapla force-pushed the frontmatter-numbering branch from ad0cf5f to a1069e2 Compare September 3, 2026 20:58
… 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
PiotrCzapla force-pushed the title-numbering-boundary branch from db57d22 to 48954ee Compare September 3, 2026 21:01
@PiotrCzapla
PiotrCzapla force-pushed the frontmatter-numbering branch from a1069e2 to 46493bc Compare September 3, 2026 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant