Repository navigation
Fancy ordered lists: alphabetic, roman, and parenthesized markers - #50
Merged
Merged
Conversation
Parse Pandoc-style fancy_lists markers (a., B), iv., (i)) as ordered
lists with inferred numbering style and start. The list node records
style (lower-alpha/upper-alpha/lower-roman/upper-roman) and delimiter
(paren/parens); plain CommonMark lists (1., 1)) keep an unchanged AST.
- myst-parser: vendor markdown-it-fancy-lists (MIT, Moxio) extended
with the Pandoc TwoParens form "(i)" that the original excludes, and
with style/delimiter metadata on the ordered_list_open token; gated
behind a fancyLists extension, enabled by default
- myst-spec-ext: List gains optional style and delimiter fields
- myst-to-html: <ol type="..."> plus a delimiter-paren(s) CSS hook
- myst-to-tex: enumitem labels, e.g. (i) -> label={(\roman*)},start=n
- myst-to-typst: #set enum(numbering: "(i)", start: n)
- myst-to-jats: list-type alpha-lower/alpha-upper/roman-lower/roman-upper
Fixes #49
Co-Authored-By: Claude Fable 5 <[email protected]>
There was a problem hiding this comment.
Pull request overview
Adds Pandoc-style “fancy” ordered-list markers (alpha/roman + ./)/(…)) to myst-parser, propagating inferred list style/delimiter metadata through myst-spec-ext and into multiple exporters (HTML/TeX/Typst/JATS), plus documentation and test coverage, addressing issue #49.
Changes:
- Vendor and enable-by-default a
fancyListsmarkdown-it list rule that parsesa.,B),iv., and(i)markers into orderedlistnodes with inferredstart,style, anddelimiter. - Extend the list node type (
myst-spec-ext) and update exporters (HTML/TeX/Typst/JATS) to render the preserved style/delimiter. - Add parser tests, exporter fixtures, and docs for the new list syntax.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/myst-to-typst/tests/lists.yml | Adds Typst fixtures for styled/parenthesized ordered lists. |
| packages/myst-to-typst/src/index.ts | Emits Typst #set enum(numbering: ...) and resets to round-trip markers. |
| packages/myst-to-tex/tests/lists.yml | Adds LaTeX fixtures covering styled and parenthesized list labels. |
| packages/myst-to-tex/src/index.ts | Uses enumitem label/start options to reproduce fancy list markers. |
| packages/myst-to-jats/tests/basic.yml | Adds fixture asserting list style → JATS list-type mapping. |
| packages/myst-to-jats/src/index.ts | Maps list style to JATS list-type values for ordered lists. |
| packages/myst-to-html/tests/html.spec.ts | Adds unit tests for <ol type> and delimiter CSS classes. |
| packages/myst-to-html/src/schema.ts | Adds list handler to set <ol type> and delimiter-* class hooks. |
| packages/myst-spec-ext/src/types.ts | Extends List type with optional style and delimiter. |
| packages/myst-parser/tests/fancylists.spec.ts | New parser test suite for fancy-list parsing and disambiguation rules. |
| packages/myst-parser/src/tokensToMyst.ts | Lifts start from list token attrs and maps token.meta → list style/delimiter. |
| packages/myst-parser/src/plugins.ts | Exports fancyListsPlugin and its options type. |
| packages/myst-parser/src/myst.ts | Enables fancyLists by default and wires plugin into tokenizer creation. |
| packages/myst-parser/src/fromMarkdown.ts | Adds extensions.fancyLists option typing. |
| packages/myst-parser/src/fancyLists.ts | New vendored/extended markdown-it list rule implementing Pandoc-style markers. |
| docs/typography.md | Documents alphabetic/roman fancy ordered list syntax and rules. |
| .changeset/fancy-lists.md | Changeset entry describing new fancy-lists support across packages. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Review feedback: resume only continues a preceding enumerate's counter, which mismatches arbitrary explicit starts (a document's first list starting at 5 rendered 1). Also guard against missing start metadata. Co-Authored-By: Claude Fable 5 <[email protected]>
mmcky
added a commit
that referenced
this pull request
Jun 12, 2026
* Track PR #50 (fancy-lists) in VERSION.yml and UPSTREAM-PRS.yml Records squash commit 1fd33e3 as merged feature 8 (tag pending) and adds a standalone upstream candidate; the upstream story pairs with a myst-theme ol-type patch tracked in #51. Co-Authored-By: Claude Fable 5 <[email protected]> * Backtick the marker examples in the fancy-lists candidate description Co-Authored-By: Claude Fable 5 <[email protected]> --------- Co-authored-by: Claude Fable 5 <[email protected]>
This was referenced Jun 12, 2026
mmcky
added a commit
to QuantEcon/claude-latex-to-myst
that referenced
this pull request
Jun 12, 2026
…ers (#111) (#149) dp1's preamble sets \setlist[enumerate,1]{label={\upshape (\roman*)}}, so the PDF numbers level-1 enumerates (i), (ii), ... — but the preamble is invisible to the per-chapter conversion and pandoc emits decimal 1./2. markers (audit QuantEcon/book-dp-public#26 item 15, the last open piece of #111). The blocker was the publisher: CommonMark has no roman list markers. QuantEcon/mystmd#50 shipped fancy ordered lists (i. / (i) / a. markers parse with style metadata), closing mystmd#49 and unblocking this. New config knob, book-side styling the tool can't infer (same category as frontmatter_style): postprocess: enumerate_style: lower-roman-parens # also: lower-roman, # lower-alpha[-parens] convert_enumerate_style (transforms/typography.py, late in process_text) maps pandoc's sequential decimal numbers to the configured marker form — list boundaries and start offsets carry over for free. Scope: - LEVEL-1 only (column-0 markers); nested lists keep decimal, matching enumitem's [enumerate,1] scope. - Fence-stack scan: code/{math} fences verbatim, and {prf:algorithm} bodies excluded (their numbered lines are algorithm2e statements per #109, not enumerates); content directives (exercises — the audited case) are processed. - Continuation lines re-indent from the old content column to the new one ((ii) is wider than 2.) so multi-paragraph items and nested blocks stay attached per CommonMark's content-column rule. - Validated at config load; default unset = byte-identical output (snapshot gate: all three fixture books behavior-preserved). Verified end-to-end against the local qe myst build: the golden output's level-1 lists (prose AND inside an {exercise} directive) carry style:lower-roman delimiter:parens in the built AST; the nested list stays plain decimal; zero build warnings. dp1 follow-up (book-side, tier 2): set the knob in mystmd/config.yaml on the mystmd-conversion branch once the book's myst pin includes mystmd#50. Closes #111. Co-authored-by: Claude Fable 5 <[email protected]>
This was referenced Jun 12, 2026
mmcky
added a commit
to QuantEcon/claude-latex-to-myst
that referenced
this pull request
Jun 13, 2026
#151) (#153) * ci: render gate — run build_smoke.py per book in Job 2 on a pinned mystmd fork (#151) CI gated on the unit suite, both golden tiers, the differential gate, and the per-book count diff — but never ran `myst build`, so output passing every structural check could still fail as a product (lesson 046: structural parity is not render parity). Job 2 (fixture-counts, label-gated, non-blocking) now runs the existing render gate per book after the count check: build_smoke.py overlays regen onto the worked-on mystmd/, runs `myst build --html`, and multiset-diffs normalized warnings against tests/baselines/build-<book>.txt (dp1's empty baseline is the zero-warning contract; any NEW warning line fails). The build uses a pinned QuantEcon/mystmd FORK ref (MYSTMD_REF = d1a942ca, v1.10.1 qe-v8) — not upstream npm mystmd: the committed baselines assume fork behavior (qe-v5 book-mode numbering, fancy lists from QuantEcon/mystmd#50, the cite-scanner fix from QuantEcon/mystmd#53). The qe-v8 *tag* builds v1.9.1, so the pin is the exact main SHA the baselines were validated against. The fork CLI bundles to one self-contained dist/myst.cjs, cached keyed on the ref so repeat runs skip the clone + bun + turbo build. init+fetch (not clone --branch) so the ref can be a tag or a bare SHA. Verified locally with the exact CI recipe: fetch d1a942ca, bun install --frozen-lockfile, bun run build -> myst.cjs reports "v1.10.1 (qe-v8)"; build_smoke --check passes all three books (dp1 0 / dp2 3 / deep-learning 18 baseline lines, exact match). Deferred from the issue (recorded there): the always-on Job-1 mini-project smoke and the pdftotext numbering comparison. Closes #151. Co-Authored-By: Claude Fable 5 <[email protected]> * ci: trigger Job 2 with fixture-check label applied Co-Authored-By: Claude Fable 5 <[email protected]> * ci: install bun via pinned oven-sh/setup-bun, not curl|bash Copilot review: the job pins pandoc and MYSTMD_REF but installed bun unpinned from bun.sh — runner drift could pull a different bun. Pin bun-version to 1.3.10, the fork's own packageManager declaration. Co-Authored-By: Claude Fable 5 <[email protected]> --------- Co-authored-by: Claude Fable 5 <[email protected]>
mmcky
added a commit
to QuantEcon/quantecon-theme.mystmd
that referenced
this pull request
Jul 16, 2026
…S, visual coverage Review follow-ups to #101, plus a real bug the new coverage caught: - app/renderers.tsx: allow-list both lookups (unknown style/delimiter values now emit nothing — no arbitrary class injection from plugin-mutated ASTs) and use start={node.start ?? undefined} so CommonMark's `0.` start survives (`||` dropped it). - styles/lists.css keys off case-sensitive `list-*` classes emitted by the renderer instead of ol[type] selectors: HTML matches [type=...] case-insensitively, so ol[type='a'] and ol[type='A'] select the same elements and the later (uppercase) rules always won — every lowercase variant rendered uppercase. Caught by eyeballing the new fixture snapshot. - tests/visual: new `lists` fixture page whose ordinary `1.` lists are stamped with style/delimiter by a fixture-local transform (fancy-lists.mjs), so coverage does not depend on the building CLI parsing fancy-list markers (stock mystmd does not — the parser is QuantEcon/mystmd#50); darwin baselines committed. A `lists-markers` test asserts <ol type>, classes, computed list-style-type, and the ::before marker content directly — a wrong marker case moves too few pixels for the snapshot's 1% diff budget. Co-Authored-By: Claude Fable 5 <[email protected]>
mmcky
added a commit
to QuantEcon/quantecon-theme.mystmd
that referenced
this pull request
Jul 16, 2026
…#101) * Render fancy ordered-list markers via a custom list renderer (#100) MyST list nodes can carry style (lower-alpha | upper-alpha | lower-roman | upper-roman) and delimiter (paren | parens), emitted by the QuantEcon mystmd fork for Pandoc fancy_lists markers such as a., iv., and (i) — see QuantEcon/mystmd#50. myst-to-react's list renderer drops both fields, so these lists rendered with plain decimal markers. - app/renderers.tsx: LIST_RENDERERS overrides the list renderer via the existing mergeRenderers extension point — maps style to the <ol type> attribute and exposes delimiter as a delimiter-paren(s) class. Plain lists emit byte-identical HTML to before. - styles/lists.css: restates the type mapping as author CSS (the presentational hint loses to prose list-style-type) and draws parenthesized markers with the built-in list-item counter, which honours <ol start>. Interim override until the fix lands upstream in jupyter-book/myst-theme alongside the fancy-lists upstreaming — tracked in QuantEcon/mystmd#51. Co-Authored-By: Claude Fable 5 <[email protected]> * Address Copilot review: allow-list lookups, start ?? , class-keyed CSS, visual coverage Review follow-ups to #101, plus a real bug the new coverage caught: - app/renderers.tsx: allow-list both lookups (unknown style/delimiter values now emit nothing — no arbitrary class injection from plugin-mutated ASTs) and use start={node.start ?? undefined} so CommonMark's `0.` start survives (`||` dropped it). - styles/lists.css keys off case-sensitive `list-*` classes emitted by the renderer instead of ol[type] selectors: HTML matches [type=...] case-insensitively, so ol[type='a'] and ol[type='A'] select the same elements and the later (uppercase) rules always won — every lowercase variant rendered uppercase. Caught by eyeballing the new fixture snapshot. - tests/visual: new `lists` fixture page whose ordinary `1.` lists are stamped with style/delimiter by a fixture-local transform (fancy-lists.mjs), so coverage does not depend on the building CLI parsing fancy-list markers (stock mystmd does not — the parser is QuantEcon/mystmd#50); darwin baselines committed. A `lists-markers` test asserts <ol type>, classes, computed list-style-type, and the ::before marker content directly — a wrong marker case moves too few pixels for the snapshot's 1% diff budget. Co-Authored-By: Claude Fable 5 <[email protected]> * test: refresh CI visual snapshots (linux baselines) --------- Co-authored-by: Claude Fable 5 <[email protected]> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This was referenced Jul 16, 2026
Plumb settings.parser.fancyLists through myst.yml (project-level opt-out for fancy-list parsing)
#75
Open
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.
Fixes #49
What
Parses Pandoc-style
fancy_listsordered-list markers —a.,B),iv., and the parenthesized form(i)— as ordered lists with inferred numbering style and start, and carries that notation through to every exporter.both now produce
listnodes instead of plain paragraphs:{ "type": "list", "ordered": true, "start": 1, "style": "lower-roman" } { "type": "list", "ordered": true, "start": 1, "style": "lower-roman", "delimiter": "parens" }How
markdown-it-fancy-listsv1.3.2 (MIT, Moxio) asfancyLists.ts, extended with:(i)/(a)/(1), which the upstream plugin deliberately excludes; parenthesized, single-paren and period markers are mutually incompatible (style change starts a new list), matching Pandocstyle/delimitermetadata on theordered_list_opentokenroman-numeralsdependency)fancyListsparser extension (likedeflist/tasklist), enabled by default; disable withextensions: { fancyLists: false }Listgains optionalstyle(lower-alpha|upper-alpha|lower-roman|upper-roman) anddelimiter(paren|parens) fields, named after CSSlist-style-typevalues / PandocListAttributes<ol type="i">etc., plus adelimiter-paren/delimiter-parensclass as a CSS hook for parenthesized markersenumitemlabels:(i)→\begin{enumerate}[label={(\roman*)},start=4](adds\usepackage{enumitem}viausePackages; templates that already load it are unaffected)#set enum(numbering: "(i)", start: 4)with reset after the list, following the existingstartpatternlist-typeattribute (roman-lower,alpha-upper, …)typography.mdCompatibility
1.,1)) keep a byte-identical AST and HTML — the full CommonMark conformance suite and the pinned myst-spec fixtures pass unchanged.i./I.starts a roman list while any other single letter is alphabetic (C.= letter C, start 3); a single uppercase letter with a period needs two trailing spaces (soB. Russell …stays a paragraph);#.continues any list.myst-to-md/myst-to-docxintentionally untouched: fancy lists degrade to decimal there, which is the right behavior for CommonMark-ish targets (e.g. ipynb export, where Jupyter cannot render fancy markers anyway).Out of scope (follow-ups)
myst-theme) currently render these as plain<ol>(decimal markers): the AST now carriesstyle/delimiter, but the theme'slistrenderer needs to emit thetypeattribute/class. Needs a small upstreammyst-to-reactpatch — tracked separately.(i)-marker lists directly.Testing
fancylists.spec.ts) covering all marker forms, disambiguation rules, list-splitting on style change, nesting, and the disable flaglists.yml), typst, jats, and htmlbun run build,bun run test(73 turbo tasks incl. CommonMark suite and e2e CLI exports) and lint pass_build/site/content/index.jsonwith correctstyle/delimiter🤖 Generated with Claude Code