Repository navigation
Support Quarto 2's div syntax for definition lists - #15140
Conversation
A `definition-list` div holding a bullet list of terms, each with a
nested bullet list of definitions, now becomes a DefinitionList:
::: {.definition-list}
* `time`
- A timestamp that identifies when the request was initiated.
- Type: string
:::
This is the syntax Quarto 2 uses in place of Pandoc's `: ` definition
lists, so authors can move to it while still on Quarto 1. It follows the
list-table precedent: a module in `modules/`, registered in
`_quarto.modules`, run as an astpipeline pass so it lands before
crossrefs and user filters.
The shape rules match Quarto 2's (`is_valid_definition_list_div` in
pampa): exactly one bullet list in the div, and each item exactly a
Plain/Para term followed by a bullet list of definitions. A div with any
other shape is left alone silently, and the div's attributes are dropped
since DefinitionList has no Attr.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Adds a Definition Lists section to Markdown Basics for the div syntax from quarto-dev/quarto-cli#15140, and a 1.11 highlight for it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Regarding CI, we have linux issues due to Koma script update, I'll fix it. Regarding this PR: Thanks for this. I ran the new test locally to see, and I also tried a few cases outside the test with 🤖 : a callout and a figure with a crossref inside a definition, a One difference with Quarto 2 I think, about nesting. With this PR, a /// Items 1 and 2 of the set, for one div: a valid list-table becomes a
/// `Table`, a valid definition-list a `DefinitionList`, an invalid
/// list-table warns Q-2-35 into `collector` and stays a div, and any other
/// div is unchanged. Neither rewrite recurses into its result, matching
/// the reader.
...
if is_valid_definition_list_div(&div) {
FilterResult(vec![transform_definition_list_div(div)], false)I rendered the test document with a q2 nightly (0.36.0-nightly.20261022): About the two open questions:
|
Good catch. I think we should match whatever Pandoc's syntax. I'll ask the robot. EDIT: Pandoc parses nested definition lists easily. You found a Quarto 2 bug! We'll fix there: quarto-dev/q2#895. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…o feature/definition-list-div
|
@cderv We have a q2 fix incoming, so let's assume the behavior in this PR is intentional. Feel free to merge it, and there's a corresponding doc PR over at quarto-dev/quarto-web#2305 |
Description
Adds support for Quarto 2's div syntax for definition lists, so authors can move to it while still on Quarto 1, ahead of a migration:
::: {.definition-list} * `time` - A timestamp that identifies when the request was initiated. - Type: string * `id` - A unique identifier. :::Each top-level bullet is a term, and the bullets nested under it are its definitions. Quarto 2 doesn't support Pandoc's
term/: definitionsyntax, and this is what it uses instead.This follows the
list-tableprecedent (#13528):src/resources/filters/modules/definitionlist.lua, registered in_quarto.modules.astpipeline-process-definition-listspass innormalize/astpipeline.lua, right after the list-table pass, so it runs before crossrefs and user filters.The structural rules match Quarto 2's (
is_valid_definition_list_div/transform_definition_list_divin pampa):PlainorPara) followed by a nested bullet list of definitions.DefinitionListhas noAttr.Like
listtable.lua, it skips thedata-poswrapper divs added by thesourceposextension.No
flagsgate:compute_flagsruns after the AST pipeline, so a flag couldn't skip this pass (the same reasonhas_list_tablesis set but unused).Open questions
list-tablestops the render with an error; Quarto 2 leaves a malformed.definition-listdiv alone silently. This PR matches Quarto 2. A warning in Quarto 1 could help people learning the syntax, but would flag what Quarto 2 accepts.::: {#foo .definition-list}loses#foo, as in Quarto 2. Keeping it would mean wrapping the list in aDiv, which differs from Quarto 2.Testing
tests/docs/smoke-all/markdown/definition-list/definition-list-div.qmd, withhtml,latexandtypstchecks for tight, loose and nested lists and for malformed divs staying divs.+sourcepos), and rendered the test document with a devquartopointed at this branch's filters throughQUARTO_SHARE_PATH; thehtml,latexandtypstassertions match that output../run-tests.shon this test or the wider suite.Documentation: quarto-dev/quarto-web#2305
Checklist
I have (if applicable):
AI-assisted PR
🤖 Generated with Claude Code