You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Visual Editor strips cross-reference ID from inline table caption #977
Switching a .qmd from source to the Visual Editor (and back) strips the cross-reference ID from a table caption written in the inline form : Caption {#tbl-one}.
After the round-trip the caption becomes : Caption and @tbl-one no longer resolves.
The equivalent div form ::: {#tbl-two} ... ::: is preserved, so the bug is specific to the inline caption attribute syntax.
Workaround and in general in Quarto, the div syntax is the most consistent one and probably the syntax that should be recommended even if a bit more verbose.
I wouldn't change any recommendations while we have the Quarto 2 work in flight. This sort of thing will be improved (and I continually thank you all for the patience...)
I investigated this from the RStudio side (rstudio/rstudio#17890 is the same bug -- regressed between RStudio 2026.01.2+418 and 2026.04.0+526; rstudio/rstudio#18170 has been closed as a duplicate of it) and found the root cause.
Root cause
The trigger is the pandoc that ships with Quarto 1.9 (pandoc 3.6.3 → 3.8.3). Pandoc 3.8.2 introduced a new table_attributes extension (jgm/pandoc#10884), enabled by default for markdown. The markdown reader now parses : Caption {#tbl-one} into the Table AST node's Attr instead of leaving {#tbl-one} as literal caption text:
The visual editor has never round-tripped TableAttr: in packages/editor/src/nodes/table/table-pandoc.ts, readPandocTable ignores token index 0 (// const kTableAttr = 0; is commented out) and writePandocTableContainer always writes an empty attr. Before pandoc 3.8.2 the id survived because it was just caption text; now it arrives in a slot the editor discards, so it's dropped on the source → visual → source round trip.
This explains why:
the div form ::: {#tbl-two} is unaffected (divs round-trip their attr),
it regressed without any table-related change in this repo (the panmirror diff between the RStudio 2026.01 and 2026.04 release branches has no table changes),
it reproduces in RStudio 2026.04+ (first release bundling Quarto 1.9) and in VS Code/Positron with Quarto ≥ 1.9.
Note it's not just crossref ids — all table attributes are dropped ({.striped}, tbl-colwidths="...", etc.).
Suggested fix
Two options that restore the previous behavior:
Re-materialize the attr as caption text on read (minimal, no version gating): in readPandocTable, read the attr (pandocAttrReadAST(tok, 0) already exists) and, when non-empty, append its textual form ({#tbl-one}) to the caption inlines. The writer can stay as is: pandoc 3.8.3 writes literal {#tbl-...} caption text back unescaped even with table_attributes enabled (verified), and re-reading parses it back into Attr, so the round trip is stable. This exactly restores the pre-3.8.2 UX where the id is visible/editable in the caption.
Disable the extension on read: add table_attributes to the disabled list in pandoc_converter.tstoProsemirror (the adjustedFormat(..., ['smart']) call). Caveat: pandoc < 3.8.2 errors on unknown extension names (The extension table_attributes is not supported for markdown.), so this needs a pandoc-version gate (there's an existing semver-check pattern in fromProsemirror).
Longer term, properly round-tripping TableAttr as a node attr (with attr-editing UI) would also preserve classes/key-values, but the options above fix the regression without new UI.
Activity
juliasilge commentedon May 14, 2026
We've also got this tracked at posit-dev/positron#13204.
mcanouil commentedon May 14, 2026
Workaround and in general in Quarto, the div syntax is the most consistent one and probably the syntax that should be recommended even if a bit more verbose.
cscheid commentedon May 14, 2026
I wouldn't change any recommendations while we have the Quarto 2 work in flight. This sort of thing will be improved (and I continually thank you all for the patience...)
gtritchie commentedon Jul 9, 2026
I investigated this from the RStudio side (rstudio/rstudio#17890 is the same bug -- regressed between RStudio 2026.01.2+418 and 2026.04.0+526; rstudio/rstudio#18170 has been closed as a duplicate of it) and found the root cause.
Root cause
The trigger is the pandoc that ships with Quarto 1.9 (pandoc 3.6.3 → 3.8.3). Pandoc 3.8.2 introduced a new
table_attributesextension (jgm/pandoc#10884), enabled by default formarkdown. The markdown reader now parses: Caption {#tbl-one}into theTableAST node'sAttrinstead of leaving{#tbl-one}as literal caption text:The visual editor has never round-tripped
TableAttr: inpackages/editor/src/nodes/table/table-pandoc.ts,readPandocTableignores token index 0 (// const kTableAttr = 0;is commented out) andwritePandocTableContaineralways writes an empty attr. Before pandoc 3.8.2 the id survived because it was just caption text; now it arrives in a slot the editor discards, so it's dropped on the source → visual → source round trip.This explains why:
::: {#tbl-two}is unaffected (divs round-trip their attr),Note it's not just crossref ids — all table attributes are dropped (
{.striped},tbl-colwidths="...", etc.).Suggested fix
Two options that restore the previous behavior:
Re-materialize the attr as caption text on read (minimal, no version gating): in
readPandocTable, read the attr (pandocAttrReadAST(tok, 0)already exists) and, when non-empty, append its textual form ({#tbl-one}) to the caption inlines. The writer can stay as is: pandoc 3.8.3 writes literal{#tbl-...}caption text back unescaped even withtable_attributesenabled (verified), and re-reading parses it back intoAttr, so the round trip is stable. This exactly restores the pre-3.8.2 UX where the id is visible/editable in the caption.Disable the extension on read: add
table_attributesto the disabled list inpandoc_converter.tstoProsemirror(theadjustedFormat(..., ['smart'])call). Caveat: pandoc < 3.8.2 errors on unknown extension names (The extension table_attributes is not supported for markdown.), so this needs a pandoc-version gate (there's an existing semver-check pattern infromProsemirror).Longer term, properly round-tripping
TableAttras a node attr (with attr-editing UI) would also preserve classes/key-values, but the options above fix the regression without new UI.