quarto-dev / quarto-dev/quarto-cli

Callout following code block renders poorly in docx

Open
#11,619 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug docx
Dominant language
JavaScript
Stars
6k
Forks
458
Avg merge
1d 9h
Merged PRs (30d)
41

Description

Bug description

When a callout block is the element immediately following a code block, (e.g. a figure or gt table), in docx format the two items are rendered in one table on separate rows. The callout then gets a very narrow right margin and doesn't display correctly. The pattern can only be broken by inserting a plaintext element in between the code block and the callout div, like some text or a horizontal rule.

Steps to reproduce
---
title: "Reprex: docx callouts following code blocks"
format: docx
---

```{r}
#| label: fig-test
#| echo: false

image(volcano)

```

::: {#tip-simple .callout-tip collapse="true" appearance="minimal" title="Simple tip"}
Lorem ipsum
:::

------------------------------------------------------------------------

```{r}
#| label: fig-test2
#| echo: false

image(volcano)

```

spacing text

::: {#tip-simple2 .callout-tip collapse="true" appearance="minimal" title="Simple tip"}
Lorem ipsum
:::

Expected behavior

Code blocks and following callouts should be isolated elements in docx output

Actual behavior

Code blocks and following callouts are merged into a single table

Your environment
  • IDE: Rstudio RStudio 2024.09.1+394
  • R version 4.4.2
  • OS: Windows 10
  • Quarto: 1.6.39 (problem persists in 1.7.2)
Quarto check output
Quarto 1.6.39
[>] Checking environment information...
      Quarto cache location: C:\Users\OBrienL\AppData\Local\quarto
[>] Checking versions of quarto binary dependencies...
      Pandoc version 3.4.0: OK
      Dart Sass version 1.70.0: OK
      Deno version 1.46.3: OK
      Typst version 0.11.0: OK
[>] Checking versions of quarto dependencies......OK
[>] Checking Quarto installation......OK
      Version: 1.6.39
      Path: C:\Users\OBrienL\AppData\Local\Programs\Quarto\bin
      CodePage: 1252

[>] Checking tools....................OK
      TinyTeX: v2024.02
      Chromium: (not installed)

[>] Checking LaTeX....................OK
      Using: TinyTex
      Path: C:\Users\OBrienL\AppData\Roaming\TinyTeX\bin\windows\
      Version: 2023

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

[>] Checking Python 3 installation....OK
      Version: 3.11.4
      Path: C:/Python311/python.exe
      Jupyter: (None)

      Jupyter is not available in this Python installation.
      Install with py -m pip install jupyter

[>] Checking R installation...........OK
      Version: 4.4.2
      Path: C:/R/R-4.4.2
      LibPaths:
        - C:/R/R-4.4.2/library
      knitr: 1.49
      rmarkdown: 2.29

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by rendering the supplied Quarto .qmd reproducer to docx, comparing the callout immediately after the code block with the version separated by text or a horizontal rule. Trace the docx output path responsible for combining adjacent elements; done means code blocks and following callouts render as separate elements without a narrow callout margin.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.