Skip to content

Render to PDF fails with conditionally-visible Markdown table in div with ID #13992

@davidskalinder

Description

@davidskalinder

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

I'm getting an error when combining a very particular combination of elements:

  • Render to PDF
  • Include a Markdown (pipe) table
  • Put the table in a div
  • Give the div an ID
  • Conditionally show the div in PDF format. This can be done with any of:
    • .content-hidden unless-format="pdf"
    • .content-visible when-format="pdf"
    • .content-hidden when-format="x" where x != "pdf"
    • .content-visible unless-format="x", where x != "pdf"

As far as I can tell, if I change any of these five conditions then the Quarto doc will render normally, but if I do all of those conditions then I get the error message below.

Steps to reproduce

---
format: pdf
---

Here is a table.

::: {#tbl-mytypes .content-visible unless-format="html"}

| Type 1 | Type 2 |
| - | - |
| Item 1 | Item 2 |

:::

Actual behavior

$ quarto render test.qmd 
pandoc 
  to: latex
  output-file: test.tex
  standalone: true
  pdf-engine: lualatex
  variables:
    graphics: true
    tables: true
  default-image-extension: pdf
  
metadata
  documentclass: scrartcl
  classoption:
    - DIV=11
    - numbers=noendperiod
  papersize: letter
  header-includes:
    - \KOMAoption{captions}{tableheading}
  block-headings: true
  
Error running filter /opt/quarto/share/filters/main.lua:
/opt/quarto/share/filters/main.lua:498: attempt to index a nil value (local 'node')
stack traceback:
	/opt/quarto/share/filters/main.lua:1189: in local 'postprocess_render'
	/opt/quarto/share/filters/main.lua:1220: in local 'filter_fn'
	/opt/quarto/share/filters/main.lua:653: in function </opt/quarto/share/filters/main.lua:643>
	(...tail calls...)
	...uarto/share/pandoc/datadir/../../filters/modules/jog.lua:34: in upvalue 'run_filter_function'
	...uarto/share/pandoc/datadir/../../filters/modules/jog.lua:223: in function <...uarto/share/pandoc/datadir/../../filters/modules/jog.lua:202>
	(...tail calls...)
	[C]: in function 'tmap'
	...uarto/share/pandoc/datadir/../../filters/modules/jog.lua:125: in upvalue 'recurse'
	...uarto/share/pandoc/datadir/../../filters/modules/jog.lua:222: in local 'jogger'
	...uarto/share/pandoc/datadir/../../filters/modules/jog.lua:171: in upvalue 'recurse'
	...uarto/share/pandoc/datadir/../../filters/modules/jog.lua:222: in function <...uarto/share/pandoc/datadir/../../filters/modules/jog.lua:202>
	(...tail calls...)
	/opt/quarto/share/filters/main.lua:572: in function </opt/quarto/share/filters/main.lua:550>
	(...tail calls...)
	/opt/quarto/share/filters/main.lua:1314: in local 'callback'
	/opt/quarto/share/filters/main.lua:1332: in upvalue 'run_emulated_filter_chain'
	/opt/quarto/share/filters/main.lua:1368: in function </opt/quarto/share/filters/main.lua:1365>
WARN: Error encountered when rendering files
ERROR: Error
    at renderFiles (file:///opt/quarto/bin/quarto.js:124863:49)
    at eventLoopTick (ext:core/01_core.js:178:7)
    at async render (file:///opt/quarto/bin/quarto.js:130645:19)
    at async _Command.actionHandler (file:///opt/quarto/bin/quarto.js:130887:24)
    at async _Command.execute (file:///opt/quarto/bin/quarto.js:10978:7)
    at async _Command.parseCommand (file:///opt/quarto/bin/quarto.js:10855:14)
    at async quarto (file:///opt/quarto/bin/quarto.js:176680:5)
    at async file:///opt/quarto/bin/quarto.js:176708:5
    at async file:///opt/quarto/bin/quarto.js:176563:14
    at async mainRunner (file:///opt/quarto/bin/quarto.js:176565:5)

Expected behavior

The document should render as a PDF with the table shown.

Your environment

  • IDE: RStudio 2026.01.0 Build 392 (but the bug occurs whether run from RStudio or a shell, or from RStudio's Terminal)
  • Ubuntu 24.04.3 LTS

Quarto check output

$ quarto check
Quarto 1.8.27
[✓] Checking environment information...
      Quarto cache location: /home/[redacted]/.cache/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.27
      Path: /opt/quarto/bin

[✓] Checking tools....................OK
      TinyTeX: v2026.02
      Chromium: (not installed)

[✓] Checking LaTeX....................OK
      Using: TinyTex
      Path: /home/[redacted]/.TinyTeX/bin/x86_64-linux
      Version: 2025

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

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

[✓] Checking Python 3 installation....OK
      Version: 3.13.3
      Path: /home/[redacted]/.pyenv/versions/3.13.3/bin/python3
      Jupyter: (None)

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

[✓] Checking R installation...........OK
      Version: 4.5.2
      Path: /usr/lib/R
      LibPaths:
        - /home/[redacted]/R/x86_64-pc-linux-gnu-library/4.5
        - /usr/local/lib/R/site-library
        - /usr/lib/R/site-library
        - /usr/lib/R/library
      knitr: 1.51
      rmarkdown: 2.30

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcrossrefluaIssues related to the lua codebase, filter chain, etc

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions