Skip to content

Visual Editor strips cross-reference ID from inline table caption #977

@mcanouil

Description

@mcanouil

Bug description

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.

Originally reported in quarto-dev/quarto-cli#14514.

Steps to reproduce

  1. Create issue.qmd:

    ---
    title: About
    format: html
    ---
    
    @tbl-one and @tbl-two
    
    | A | B | C |
    |---|---|---|
    | 1 | 2 | 3 |
    
    : Caption {#tbl-one}
    
    ::: {#tbl-two}
    
    | A | B | C |
    |---|---|---|
    | 1 | 2 | 3 |
    
    Caption
    
    :::
  2. Open in the Visual Editor, make any edit (or just toggle and save).

  3. Switch back to source.

Actual behavior

The {#tbl-one} attribute is removed from the caption:

| A   | B   | C   |
|-----|-----|-----|
| 1   | 2   | 3   |

: Caption

@tbl-one renders as ?@tbl-one and the cross-reference is broken.
The {#tbl-two} div form survives the round-trip unchanged.

Expected behavior

The Visual Editor should preserve {#tbl-one} on the table caption across round-trips, matching its behaviour for div-wrapped tables.

Your environment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions