Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Feature Request: add support for cross-reference IDs in the Visual Editor’s DOM

未关闭
#929 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
55/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
停滞
技术栈
typescript
领域
frontend

调研方向

Start with the Visual Editor's figure and equation handling, using a .qmd file containing {#fig-f1} and {#eq-e1} to reproduce the missing attributes. Compare that DOM with the renderer's existing cross-reference ID behavior; done means the corresponding root figure and equation elements expose their source IDs while unlabeled elements remain unchanged.

由索引模型根据 Issue 内容生成。

描述

enhancement visual-editor

Summary
When a figure or equation has a Quarto cross-reference ID in source mode (e.g., {#fig-f1} or {#eq-e1}), the Visual Editor does not add that ID to the corresponding DOM element. This prevents custom editor CSS from distinguishing labeled from unlabeled figures and equations.

Current behavior
Figures with or without IDs produce identical DOM in the Visual Editor:

![A caption](image.png){.fs}
![A caption](image.png){#fig-t1 .fs}

Both render as:

<figure class="pm-figure ...">
  ...
    <figcaption class="pm-figcaption" contenteditable="true">A caption</figcaption>
</figure>

Equations behave similarly:

$$ x $$
$$ y $$ {#eq-t1}

No cross-reference ID appears in the editor DOM, even though the rendered output correctly includes it.

Desired behavior
When a figure or equation has a cross-reference ID, it should appear in the DOM as the id attribute on the root element:
<figure id="fig-f1" class="pm-figure ...">

Why this matters
I maintain a custom CSS stylesheet injected into the Visual Editor to make it more closely resemble the rendered output: CSS stylesheet on GitHub

Some things my stylesheet handles:
• Figure and table numbering via CSS counters (e.g., Fig 1:, Table 2:)
• Equation numbering via CSS counters
• Section/heading numbering (e.g., 2-3.1)
• Paragraph and bullet spacing adjustments

Without IDs in the DOM, CSS cannot differentiate numbered/referenceable elements from unnumbered ones:

/* Would work if IDs were present in the DOM */
figure[id^="fig-"]       { /* numbered figure */ }

Our group produces a large number of documents and lessons, making the visual editor our primary authoring environment. This limitation means the numbering in the editor will often not match the rendered output. This makes editing and proofreading harder, especially in large documents with many figures and equations.

Minimal ask
Write the cross-reference ID onto the <figure> and equation DOM elements in the Visual Editor whenever one exists in source — exactly as the renderer already does.

Environment
Confirmed in Visual Editor in RStudio, Positron, and VSCode on Windows 11 and Linux Mint 22.

Reproducible with any .qmd file containing:

![caption](img.png){#fig-f1}
$$ ... $$ {#eq-e1}
主要语言
TypeScript
星标
655
派生
64
平均合并
8 小时 45 分钟
30 天内合并 PR
36

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

quarto-dev/quarto 的其他 Issue

查看 quarto-dev/quarto 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。