Indenting executable codeblocks makes them malfunction
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Use the minimal Quarto example in the report as the reproducer; inspect the generated Markdown and resulting HTML for indented executable blocks outside and inside lists. Done means the list case is emitted as valid Markdown and the handling of top-level indentation is explicitly settled without breaking ordinary indented Markdown.
Written by the indexing model from the issue text.
Description
Bug description
Normal markdown code supports nesting environments into one-another using indentation. For example, lists can be nested. Paragraphs can be nested into a list bullet-point. Also, indentation can be used to mark a verbatim block.
However, indenting executable code blocks makes them malfunction (for jupyter).
Steps to reproduce
This minimal example compiles to very weird markdown. The resulting html is weird. As far as I can tell, this is due to correct parsing of the weird markdown.
NB: this is a minimal example with a stupid output. The issue persists if using a Markdown(tabulate(...)) example or a matplotlib figure.
---
execute:
echo: false
format: markdown
---
# Minimal example
```{python}
print("- Foo")
```
```{python}
print("- Foo")
```
- Nesting list
- Foo
- Nesting list:
```{python}
print("- Foo")
```
After compilation
# Minimal example
:::: {.cell execution_count="1"}
::: {.cell-output .cell-output-stdout}
- Foo
:::
::::
::: {.cell execution_count=2}
::: {.cell-output .cell-output-stdout}
```
- Foo
```
:::
:::
- Nesting list
- Foo
- Nesting list:
::: {.cell execution_count=3}
::: {.cell-output .cell-output-stdout} \`\`\`
- Foo \`\`\` ::: :::
Expected behavior
I'm not sure what the expected behavior should be, without breaking everything and making everything super complex.
-
For indentation outside of any context (first half of the example), I'm not sure if there is even any solution that makes sense:
- maintaining indentation results in a verbatim code block, which is very weird
- changing the markdown produced by execution sounds very complicated for very little benefit
- can verbatim blocks from indentation be turned off in pandoc? I don't think so?
- the simplest might be to write in the documentation that indenting produces this weird behavior?
-
For indentation inside of a list, like in the second half of the example, I would expect the behavior to be that indentation is preserved and produces correct markdown. I think the issue here is only that the markdown is mangled somehow.
Actual behavior
- indentation outside of context: produces ugly verbatim code
- indentation inside of context of list: mangled output, probably due to incorrect parsing of the div delimiters
Your environment
- IDE: vscode
- OS: windows 11
Quarto check output
Quarto 1.5.45
[>] Checking versions of quarto binary dependencies...
Pandoc version 3.2.0: OK
Dart Sass version 1.70.0: OK
Deno version 1.41.0: OK
Typst version 0.11.0: OK
[>] Checking versions of quarto dependencies......OK
[>] Checking Quarto installation......OK
Version: 1.5.45
Path: C:\Users\Guillaume\AppData\Local\Programs\Quarto\bin
CodePage: 1252
[>] Checking tools....................OK
TinyTeX: (not installed)
Chromium: (not installed)
[>] Checking LaTeX....................OK
Tex: (not detected)
[>] Checking basic markdown render....OK
[>] Checking Python 3 installation....(None)
Unable to locate an installed version of Python 3.
Install Python 3 from https://www.python.org/downloads/
[>] Checking R installation...........(None)
Unable to locate an installed version of R.
Install R from https://cloud.r-project.org/
PS D:\Desktop\Dojo\quarto_bug_report_listings>
I'm not sure why python is not seen but everything compiles as it should:
Python 3.12.4 (tags/v3.12.4:8e8a4ba, Jun 6 2024, 19:30:16) [MSC v.1940 64 bit (AMD64)] on win32
- Dominant language
- JavaScript
- Stars
- 6k
- Forks
- 458
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 41
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.
More from quarto-dev/quarto-cli
-
binder bug
Difficulty 1/5 Under an hour Newbie friendliness 92/100
quarto-dev/quarto-cli#14907 · 3 comments ·
-
brand bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
quarto-dev/quarto-cli#14891 ·
-
brand bug html revealjs
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
quarto-dev/quarto-cli#14882 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
quarto-dev/quarto-cli#14875 ·
-
Percent scripts: accept raw-string (r""") and '''-delimited markdown cells, as jupytext writes them Openengines-jupyter enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
quarto-dev/quarto-cli#14850 · 2 comments ·
All issues in quarto-dev/quarto-cli
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
avniproject/avni-client#2135 ·
-
automated broken-link
Difficulty 1/5 Under an hour Newbie friendliness 85/100
-
agent/security hive/hosted-available-lke648397-260827-5n31 security
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
babalae/bettergi-scripts-list#3674 ·
-
A-Release-Notes C-Editing D-Modest S-Ready-For-Implementation
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
bevyengine/bevy-website#2595 ·