Skip to content

.md file with key-attribute first in fenced code block is wrongly detected as executable code cell #14182

@mcanouil

Description

@mcanouil

Bug description

When rendering a .md file, Quarto incorrectly detects a fenced code block as an executable code cell if the first attribute is a key-value pair rather than a class.

For example, ```{filename="demo.sh" .bash} triggers the error, while ```{.bash filename="demo.sh"} renders correctly.

The attribute order should not matter. Both forms are valid Pandoc fenced code block attributes and neither represents an executable code cell.

Steps to reproduce

Save the following as demo.md:

---
title: demo
---

```{filename="demo.sh" .bash}
echo "Hello"
```

Then run:

quarto render demo.md

Actual behavior

ERROR: You must use the .qmd extension for documents with executable code.

Expected behavior

The document should render successfully, just as it does when the class appears before the key-value attribute:

```{.bash filename="demo.sh"}
echo "Hello"
```

Your environment

  • OS: macOS (Darwin 25.3.0)

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.8.3: OK
      Dart Sass version 1.87.0: OK
      Deno version 2.4.5: OK
      Typst version 0.14.2: OK

[✓] Checking versions of quarto dependencies......OK

[✓] Checking Quarto installation......OK
      Version: 99.9.9
      commit: cb7f370bed23fca88ab932b0f72bb59173f88b7e
      Path: /Users/mcanouil/Projects/quarto-dev/quarto-cli/package/dist/bin

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

[✓] Checking LaTeX....................OK
      Using: TinyTex
      Path: /Users/mcanouil/Library/TinyTeX/bin/universal-darwin
      Version: 2025

[✓] Checking Chrome Headless....................OK
      Using: Chrome from QUARTO_CHROMIUM
      Path: /Applications/Brave Browser.app/Contents/MacOS/Brave Browser

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

[✓] Checking R installation...........OK
      Version: 4.5.2
      Path: /Library/Frameworks/R.framework/Resources
      LibPaths:
        - /Users/mcanouil/Projects/quarto-dev/quarto-playground/renv/library/macos/R-4.5/aarch64-apple-darwin20
        - /Users/mcanouil/Library/Caches/org.R-project.R/R/renv/sandbox/macos/R-4.5/aarch64-apple-darwin20/4cd76b74
      knitr: 1.50
      rmarkdown: 2.30

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

[✓] Checking Python 3 installation....OK
      Version: 3.14.0
      Path: /Users/mcanouil/Projects/quarto-dev/quarto-playground/.venv/bin/python3
      Jupyter: 5.9.1
      Kernels: uv, julia-1.12, python3

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

[✓] Checking Julia installation...
      Version: 1.12.0
      Path: /Users/mcanouil/.juliaup/bin

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions