quarto-dev / quarto-dev/quarto-cli

Issue rendering embedded notebook cells with titles containing double quotes

Open
#8,918 0 comments 0 reactions 1 assignee View on GitHub

@cscheid is already working on this.

Since Jun 5, 2024.

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

Description

Bug description

Our instance of Quarto involves several code samples in both R and Python being stored in Jupyter notebooks. I noticed the formatting of one of our pages was breaking, and after some time, I was able to narrow it down to the following general scenario:

  1. Create a Jupyter notebook with a single cell.
  2. The first line of the notebook after the Jupyter cell front matter should be a comment line.
  3. That comment line should contain a mixture of text in "double quotes" and text outside double quotes.
  4. That cell should be embedded in a .qmd file.

Under this general scenario, I think Quarto is assuming that the first comment line is the notebook's title, but it's not escaping any of the double quotes, so it breaks the formatting.

Steps to reproduce
  1. Clone this repo: https://github.com/nickvigilante/embed-comment-quote-bug
  2. quarto preview
Expected behavior

Both pages should render without issues and look something like this:

image

Actual behavior

When the first comment in the first cell of a notebook contains double quotes and is embedded in a notebook, the following is shown:

image

Your environment
  • IDE: VS Code 1.86.2
  • macOS Sonoma 14.2.1 (23C71)
Quarto check output
(miniconda3)➜  tabset-embed-comment-quote-bug git:(main) quarto check
Quarto 1.4.550
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.1.11: OK
      Dart Sass version 1.69.5: OK
      Deno version 1.37.2: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.4.550
      Path: /Applications/quarto/bin

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

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

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

[✓] Checking Python 3 installation....OK
      Version: 3.11.5 (Conda)
      Path: /Users/nickv/miniconda3/bin/python
      Jupyter: 5.5.0
      Kernels: ir, python3

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

[✓] Checking R installation...........OK
      Version: 4.3.2
      Path: /Library/Frameworks/R.framework/Resources
      LibPaths:
        - /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library
      knitr: 1.45
      rmarkdown: 2.25

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

(miniconda3)➜  tabset-embed-comment-quote-bug git:(main) 

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.