quarto-dev / quarto-dev/quarto-cli

Long inline `<code>` snippets within lists do not wrap (HTML documents)

Open
#13,258 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

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

This is similar to these old issues about inline <code> not wrapping: https://github.com/quarto-dev/quarto-cli/issues/2649, https://github.com/quarto-dev/quarto-cli/issues/3221

Those two issues are fixed, but there seems to be another edge case with inline <code> not wrapping if it's inside a list. Outside of lists, <code> gets white-space: pre-wrap styling that wraps the text. Within lists, <code> gets white-space: pre styling that does not wrap.

We found this CSS that sets pre-wrap on code only if code is inside a <p>, which doesn't happen for code within lists.

https://github.com/quarto-dev/quarto-cli/blob/c6987f7156e5de96da78cf5be281fc64689b7333/src/resources/formats/html/_quarto-rules.scss#L289-L294

It's a really minor issue, but I think you could hit this in some common cases. We discovered it in the Posit Package Manager release notes, where we have lists of changes that occasionally contain long inline error messages wrapped in code. The release notes have a sidebar that limit the width of the content, so we had a few occurrences of this.

We also worked around it by separating each list item with a newline, which gets each list item wrapped in a <p>. But this is somewhat of an awkward workaround.

Steps to reproduce

Repro doc:

---
title: "Test for text wrapping of long inline `<code>` snippets in lists"
---

## Unordered list

Unordered list. `<code>` within lists gets `white-space: pre` styling which does not wrap.

- `Code 1`
- `Code 2`
- `This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet.`
- Item 4


## Unordered list with line breaks (workaround)

Unordered list with line breaks. Each item gets wrapped in `<p>` which matches the `white-space: pre-wrap` CSS. This works around the issue, but the extra space between list items can be awkward.

- `Code 1`

- `Code 2`

- `This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet.`

- Item 4

## Ordered list

Ordered list:

1. `Code 1`
2. `Code 2`
3. `This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet.`
4. Item 

## Inline code by itself

Outside of lists, this gets wrapped in `<p>` so it gets the `white-space: pre-wrap` CSS.

`This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet. This is a really long inline code snippet.`
rendered output of the doc
Actual behavior

The inline code items do not wrap in the Unordered list and Ordered list cases.

Expected behavior

The inline code items wrap in the Unordered list and Ordered list cases.

Your environment
  • Positron 2025.08.0
  • Windows 11
Quarto check output
Quarto 1.8.21
[>] Checking environment information...
      Quarto cache location: C:\Users\greg\AppData\Local\quarto
[>] Checking versions of quarto binary dependencies...
      Pandoc version 3.6.3: OK
      Dart Sass version 1.87.0: OK
      Deno version 2.3.1: OK
      Typst version 0.13.0: OK
[>] Checking versions of quarto dependencies......OK
[>] Checking Quarto installation......OK
      Version: 1.8.21
      Path: C:\Users\greg\AppData\Local\Programs\Quarto\bin
      CodePage: 1252

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

[>] Checking LaTeX....................OK
      Tex:  (not detected)

[>] Checking Chrome Headless....................OK
      Using: Chrome found on system
      Path: C:\Program Files\Google\Chrome\Application\chrome.exe
      Source: Windows Registry

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

[>] Checking Python 3 installation....OK
      Version: 3.13.3
      Path: C:/Users/greg/AppData/Local/Programs/Python/Python313/python.exe
      Jupyter: (None)

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

[>] Checking R installation...........OK
      Version: 4.5.1
      Path: C:/PROGRA~1/R/R-45~1.1
      LibPaths:
        - C:/Users/greg/AppData/Local/R/win-library/4.5
        - C:/Program Files/R/R-4.5.1/library
      knitr: 1.50
      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 with src/resources/formats/html/_quarto-rules.scss at lines 289-294, then render the supplied Quarto reproduction document. Compare long inline code in ordered and unordered lists with the paragraph case, and verify that the list examples wrap in the generated HTML output without relying on the newline workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
scss
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.