Repository navigation
Keep heading id on sections Pandoc 3.13 merges with a wrapper div - #15344
Merged
Merged
Conversation
Collaborator
✅ 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. |
cderv
force-pushed
the
fix/pandoc-3.13-section-ids
branch
from
November 12, 2026 11:49
a8148ee to
80d021c
Compare
cderv
marked this pull request as ready for review
November 12, 2026 14:06
This was referenced Nov 12, 2026
Merged
cderv
force-pushed
the
fix/pandoc-3.13-section-ids
branch
from
November 12, 2026 17:00
80d021c to
ab48d75
Compare
…r div Pandoc 3.10.1+ merges a Div with an id that starts with a heading into the heading's section and gives the section the Div's id (jgm/pandoc#11745). In HTML the TOC, anchor links, search and the crossref preview then use the wrapper id while crossrefs use the heading id. Beamer, DocBook, ConTeXt and AsciiDoc drop the heading id entirely (jgm/pandoc#12070), and revealjs strips slide heading ids, so crossrefs to such headings dangle. A finalize filter swaps the two ids exactly where Pandoc merges, keeping the single section and its classes. It follows makeSections' own walk (Div nesting only, sections split by nested headings) and runs only for the formats where the merge changes ids: LaTeX, Typst and docx already write both ids, and a swap there moves the crossref label off the heading.
cderv
force-pushed
the
fix/pandoc-3.13-section-ids
branch
from
November 12, 2026 17:03
ab48d75 to
2849f97
Compare
cderv
added a commit
that referenced
this pull request
Nov 12, 2026
Regroup the Pandoc 3.13 entries in the 1.12 changelog the way earlier Pandoc updates were recorded (see news/changelog-1.9.md). The update line under Dependencies now lists only the Pandoc changes that alter existing documents with no Quarto change. Quarto's own template and style ports move under the format they affect, the section id change goes under All Formats, and --math-method support goes under Commands. See #15320, #15321 and #15344, which added the entries.
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.
Pandoc 3.10.1 and later (jgm/pandoc#11745) merge a Div with an id that starts with a heading into a single section. The section takes the Div's id and the heading keeps its own. Quarto's crossrefs still target the heading id, so ids start to disagree once the bundled Pandoc moves to 3.13 (#15320).
For
::: {#sec-other}wrapping## Second {#sec-second}in HTML:data-anchor-id) point at#sec-other, while@sec-secondpoints at#sec-second#sec-othertooOther formats are worse. Revealjs strips the slide heading id, and beamer, DocBook, ConTeXt and AsciiDoc no longer write the heading id at all (jgm/pandoc#12070), so a crossref to such a heading has no target.
Fix
A finalize filter (
quarto-finalize/section-ids.lua) swaps the two ids exactly where Pandoc merges. The section keeps the heading id, so TOC, anchors, search and crossrefs agree again, and the wrapper id stays addressable on the heading. The wrapper's classes stay on the section, which is the 3.13 behavior.The condition follows Pandoc's own
makeSectionswalk: Div nesting only, with sections split by a later heading of the same or higher level. It runs for HTML, EPUB, revealjs, beamer, DocBook, ConTeXt and AsciiDoc. LaTeX, Typst and docx already write both ids, and a swap there would move the crossref label off the heading. Divs with classcell,column,columnsorfragmentare left alone. An explicit.sectionwrapper in HTML keeps Pandoc's new result, since that is the case upstream merges on purpose.Alternative considered: accept Pandoc's ids and align Quarto to the wrapper id. That touches the anchor postprocessor, TOC links, the search index and the xref preview script, and still ends with different ids on the section than in 3.10.
Dashboards are unaffected by the filter. A characterization test pins that wrapped rows and cards are not nested inside other cards on 3.13.
Third layer of a stack: #15320 (Pandoc 3.13 bump) <- #15321 <- this PR. The new changelog line sits under the
pandoc3.13 entry from #15320.Checklist
I have (if applicable):
AI-assisted PR
Note: autonomous AI agents submitting PRs without human oversight are not permitted — see the Code of Conduct.