DOCX: callouts end with an empty paragraph, also when not needed

未关闭 适合新手
#15,394 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
81/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
javascript
领域
documentation

调研方向

阅读 src/resources/filters/quarto-post/docx.lua 第 101–107 行附近,issue 指出空段落会被无条件添加。比较以段落结尾的 callout 内容和以表格结尾的内容,然后渲染提供的 DOCX 示例并检查 word/document.xml。当额外段落只在未以段落结尾的内容之后有需要时才出现,即为完成。

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

描述

bug callouts docx regression
I have:
  • searched the issue tracker for similar issues
  • installed the latest version of Quarto CLI
  • formatted my issue following the Bug Reports guide
Bug description

In DOCX output, callout boxes with the default appearance always end with an empty paragraph <w:p/> after their content. In LibreOffice Writer, it shows as an unnecessary empty line at the end of every such callout. (I don't have Word to check whether it shows the empty line there as well; it would be great if someone could confirm.)

The empty paragraph was added in #12642 (port of #8392, fixing #6357), because a table cell must end with a paragraph, e.g., when the callout content ends with a table.
However, it's added unconditionally:
https://github.com/quarto-dev/quarto-cli/blob/cda41021442b20964e10e265b9dcdf81f490c18e/src/resources/filters/quarto-post/docx.lua#L101-L107

Callouts with appearance="simple" or "minimal" are not affected.
The issue persists with the latest pre-release 1.12.3.

I investigated this with the help of an AI assistant, grounded in the Quarto source; I verified the findings myself.

Steps to reproduce

Create a source doc with DOCX output and a callout box:

---
format: docx
---

::: {.callout-note}
This is a callout.
:::

Run quarto render, and open the DOCX, e.g., in LibreOffice Writer.

Actual behavior

The callout's body cell in word/document.xml ends with an empty paragraph (abridged):

<w:tc>
  <w:tcPr>...</w:tcPr>
  <w:p>
    ...
    <w:r>
      <w:t xml:space="preserve">This is a callout.</w:t>
    </w:r>
  </w:p>
  <w:p/>
</w:tc>

Here an annotated screenshot from LibreOffice:

Screenshot of Quarto's docx file in LibreOffice. It shows a textbox with an additional empty space, and a sad emoji is drawn by hand next to it.
Expected behavior

The empty paragraph is only added when the callout content does not already end with a paragraph, e.g., when it ends with a table.

Your environment
  • IDE: none, quarto render on the command line
  • OS: Ubuntu Linux, kernel 7.0.0-43
  • LibreOffice Writer 24.2.7.2
Quarto check output
$ quarto check
Quarto 1.11.9
[✓] Checking environment information...
      Quarto cache location: /home/$USER/.cache/quarto
      Project root: /home/$USER/
      Project config: /home/$USER/_quarto.yml
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.10.0: OK
      Dart Sass version 1.101.0: OK
      Deno version 2.9.8: OK
      Typst version 0.15.1: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.11.9
      Path: /opt/quarto/bin

[✓] Checking tools....................OK
      TinyTeX: v2026.04
      Chrome Headless Shell: (not installed)
      VeraPDF: (not installed)

[✓] Checking LaTeX....................OK
      Using: TinyTex
      Path: /home/$USER/.TinyTeX/bin/x86_64-linux
      Version: 2026

[✓] Checking Chrome Headless....................OK
      Using: Chrome found on system
      Path: /usr/bin/google-chrome
      Source: PATH

[✓] Checking basic markdown render....OK

[✓] Checking R installation...........OK
      Version: 4.4.3
      Path: /home/$USER/apps/miniforge3/lib/R
      LibPaths:
        - /home/$USER/apps/miniforge3/lib/R/library
      knitr: 1.50
      rmarkdown: 2.29

[✓] Checking Knitr engine render......OK

[✓] Checking Python 3 installation....OK
      Version: 3.12.11 (Conda)
      Path: /home/$USER/apps/miniforge3/bin/python
      Jupyter: (None)

      Jupyter is not available in this Python installation.
      Install with conda install jupyter

[✓] Checking Julia installation...
主要语言
JavaScript
星标
6.2k
派生
492
平均合并
15 小时 15 分钟
30 天内合并 PR
94

环境准备

从这里开始

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

quarto-dev/quarto-cli 的其他 Issue

查看 quarto-dev/quarto-cli 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

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