Repository navigation
Conversation
…numeric styles
A definition list inside a `::: {.references}` container is a bibliography. Its id-bearing terms register as `cite` targets instead of `text`. `[@key]` renders parenthetically, "(Dai and Le, 2015)"; `{ref=text}` textually, "Dai and Le (2015)"; `-@` as the bare label. A group of citations shares one pair of parentheses with "; " between entries. `page`, `leaf` and `rel` are errors on a citation.
`cite='numeric'` on mdhtml2html, md2gfm and mdhtml2typst numbers the entries in list order, renders "[1]", "[1, 3]" and "Dai and Le [1]", and relabels each term with its number. The HTML exporter wraps every citation in `span.cite` so a page can attach a hover card from the entry its link targets.
`references` joins `math` and `footnotes` as a reserved class word. docs/DIALECT.md gains a citations section; the parser is unchanged.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
Stacked on #78. A definition list inside a
::: {.references}container is a bibliography, and references to its terms are citations with their own rendering rules. The parser is unchanged: thereferencesclass on the container is the marker, and it joinsmathandfootnotesas a reserved class word.What changes
citejoinsblock,captionandtextas a target kind. An id-bearingdtinsidediv.referencesregisters ascite(doc_anchorsand the HTML exporter both see the container).[@dai2015]renders parenthetically, "(Dai and Le, 2015)"; prefix text goes inside, "(see Dai and Le, 2015)".[@dai2015]{ref=text}renders textually, "Dai and Le (2015)", splitting the label at its last ", " (a label with no comma renders as written).[-@dai2015]renders the label alone, for an author who writes the parentheses. A group[@a; @b]shares one pair of parentheses with "; " between entries.page,leafandrelare errors on a citation.cite='numeric'onmdhtml2html,md2gfmandmdhtml2typstnumbers the entries in list order and renders "[1]", "[1, 3]", "Dai and Le [1]", relabelling each term with its number. Only terms with ids take a number, in every exporter.<span class="cite">with its links inside, so a viewer can attach a hover card from the entry each link targets. Typst escapes the numeric brackets; GFM bakes plain text.Resolvergainsset_cite_style,set_citenum,is_cite,cite_wrapandcite_sep, exposed to Python.citeoption.Tests:
test_citationsin tests/test_export.py covers the three forms, groups, prefix text, a label with no comma, the numeric style in all three exporters, and the error cases.🤖 Generated with Claude Code