Skip to content

Theme rendering for fancy ordered lists (ol type + delimiter class) #51

@mmcky

Description

@mmcky

Follow-up to #49 / PR #50.

PR #50 makes the parser and exporters handle Pandoc-style fancy list markers (a., iv., (i)), and the site AST now carries the metadata:

{ "type": "list", "ordered": true, "start": 1, "style": "lower-roman", "delimiter": "parens" }

However, the site themes render lists via myst-to-react (basic.tsx list handler), which only emits <ol start id className> — so HTML site builds (e.g. book-dp1 with template: book-theme) still display decimal markers.

What's needed

In myst-to-react's list component:

  1. Map node.style to the <ol type> attribute (lower-romani, upper-alphaA, …) — browsers then render roman/alpha markers natively.
  2. For node.delimiter (paren / parens), add a class (e.g. delimiter-parens) plus theme CSS using ::marker / CSS counters to render (i) instead of i. — matching the static-HTML hook added in PR Fancy ordered lists: alphabetic, roman, and parenthesized markers #50's myst-to-html.

Options

  • Upstream PR to jupyter-book/myst-theme (right long-term home; small, self-contained change).
  • For book-dp1 in the meantime: a custom/forked book-theme build, or site CSS keyed off ol[type] once the type attribute lands (the attribute alone covers the i. rendering; only the parens wrapper needs CSS).

Until this lands, fancy lists in HTML site builds show decimal markers but with correct ordering/start — a strict improvement over the previous plain-paragraph rendering.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions