Skip to content

The characters between inverted commas printed with # | output: asis and format: gfm vary depending on random factors. #12854

Open
@JosephBARBIERDARNAL

Description

@JosephBARBIERDARNAL

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 trying to generate a Markdown file with format: gfm. My Quarto file basically contains Python code that prints "asis" a few strings that should be quoted with ".

The issue is that the Markdown output file actually uses the following quote symbols: and instead of ".

This might happen or not in different scenarios. Sometimes it does, sometimes it doesn't.

The only case I've been able to reliably reproduce is when there's also an R code chunk. In that case, it uses the correct quote symbol ("). But if I remove the R chunk, it switches to the other ones.

I'm pretty sure the "error" (if that's what it is) could be reproduced without an R code chunk, but I haven't been able to pinpoint exactly when it happens.

A similar thing happens with the ' symbol, see the reprex.

Steps to reproduce

  • Case 1 (with R chunk): python output is valid, it actually put the right symbols (' and ")
---
format: gfm
---


```{python}
# | output: asis

x = "cat"
print(f"'{x}'")
print(f'"{x}"')
```

```{r}
# | output: asis

x = "cat"
print(glue::glue("'{x}'"))
print(glue::glue('"{x}"'))
```
  • Case 2 (without R chunk): python output is not valid, it puts the / and / symbols instead
---
format: gfm
---


```{python}
# | output: asis

x = "cat"
print(f"'{x}'")
print(f'"{x}"')
```

Actual behavior

It prints the "wrong" (at least unexpected) symbols (/ and /).

Output of case 2:

``` python
x = "cat"
print(f"'{x}'")
print(f'"{x}"')
```

‘cat’ “cat”

Expected behavior

I wish it always output the " (and ') symbols, as this leads to unexpected behaviors in some use cases.

Maybe I can just run a post-render script to replace those symbols, but it still feels like a bug to me.

expected output of case 2:

``` python
x = "cat"
print(f"'{x}'")
print(f'"{x}"')
```

'cat' "cat"

Your environment

  • OS: macos sequoia 15.5
  • IDE: Positron 2025.05.0 (Universal) build 142

Quarto check output

Quarto 1.7.31
[✓] Checking environment information...
Quarto cache location: /Users/josephbarbier/Library/Caches/quarto
[✓] Checking versions of quarto binary dependencies...
Pandoc version 3.6.3: OK
Dart Sass version 1.85.1: OK
Deno version 1.46.3: OK
Typst version 0.13.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
Version: 1.7.31
Path: /Applications/quarto/bin

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

[✓] Checking LaTeX....................OK
Using: Installation From Path
Path: /Library/TeX/texbin
Version: 2022

[✓] Checking Chrome Headless....................OK
Using: Chrome found on system
Path: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
Source: MacOS known location

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

[✓] Checking Python 3 installation....OK
Version: 3.13.1
Path: /Users/josephbarbier/Desktop/morethemes/.venv/bin/python3
Jupyter: 5.8.1
Kernels: python3

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

[✓] Checking R installation...........OK
Version: 4.5.0
Path: /Library/Frameworks/R.framework/Resources
LibPaths:
- /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/library
knitr: 1.50
rmarkdown: 2.29

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

Other

I tried to add:

---
format: gfm
post-render: sed -i '' 's/[“”]/"/g' docs/index.md
---

But that does not fix the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions