quarto-dev / quarto-dev/quarto-cli
Contents shortcode does not work on code-cell div with `knitr`
Open
@cderv is already working on this.
Since Feb 13, 2025.
bug
early-in-release
engines-knitr
shortcodes
- Dominant language
- JavaScript
- Stars
- 6k
- Forks
- 458
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 41
Description
Bug description
It appears {{< contents ID >}} cannot move code-cells with an ID when the engine is set to knitr.
I'm not sure what the limitation actually is:
Currently, {{< contents >}} itself does not work inside code elements. We may lift that limitation in the future.
Steps to reproduce
| Jupyter (works) | knitr (does not work) | |
|---|---|---|
| Div |
|
|
| Cross-ref Div |
|
|
Expected behavior
Content is moved without warning.
Actual behavior
WARNING (/Users/mcanouil/Projects/quarto/quarto-cli/src/resources/filters/./quarto-pre/contentsshortcode.lua:79) [Malformed document] Found `contents` shortcode without a corresponding div with id: my-figure.
This might happen because the shortcode is used in div context, while the id corresponds to a span.
Removing from document.
WARNING (/Users/mcanouil/Projects/quarto/quarto-cli/src/resources/filters/./quarto-pre/contentsshortcode.lua:79) [Malformed document] Found `contents` shortcode without a corresponding div with id: fig-figure.
This might happen because the shortcode is used in div context, while the id corresponds to a span.
Removing from document.
Your environment
No response
Quarto check output
Quarto 99.9.9
[✓] Checking environment information...
Quarto cache location: /Users/mcanouil/Library/Caches/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: 99.9.9
commit: b822c3f5cc2b7dd57238bed2bcbbd2c2ed7688b8
Path: /Users/mcanouil/Projects/quarto/quarto-cli/package/dist/bin
[✓] Checking tools....................OK
TinyTeX: v2025.02
Chromium: (not installed)
[✓] Checking LaTeX....................OK
Using: TinyTex
Path: /Users/mcanouil/Library/TinyTeX/bin/universal-darwin
Version: 2024
[✓] Checking Chrome Headless....................OK
Using: Chrome found on system
Path: /Applications/Brave Browser.app/Contents/MacOS/Brave Browser
Source: QUARTO_CHROMIUM
[✓] Checking basic markdown render....OK
[✓] Checking Python 3 installation....OK
Version: 3.13.2
Path: /Users/mcanouil/Projects/quarto/quarto-playground/.venv/bin/python
Jupyter: 5.7.2
Kernels: julia-1.11, python3
[✓] Checking Jupyter engine render....OK
(|) Checking R installation...........ℹ R version 4.4.2 (2024-10-31)
! Config '~/.Rprofile' was loaded!
[✓] Checking R installation...........OK
Version: 4.4.2
Path: /Library/Frameworks/R.framework/Resources
LibPaths:
- /Users/mcanouil/Projects/quarto/quarto-playground/renv/library/macos/R-4.4/aarch64-apple-darwin20
- /Users/mcanouil/Library/Caches/org.R-project.R/R/renv/sandbox/macos/R-4.4/aarch64-apple-darwin20/f7156815
knitr: 1.46
rmarkdown: 2.29
[✓] Checking Knitr engine render......OK
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.