diff --git a/news/changelog-1.5.md b/news/changelog-1.5.md index 8dae600ea5f..b34777364bf 100644 --- a/news/changelog-1.5.md +++ b/news/changelog-1.5.md @@ -60,6 +60,7 @@ All changes included in 1.5: - When searching for kernelspecs that match `python`, prefer one one that matches an active Python venv. - ([#8454](https://github.com/quarto-dev/quarto-cli/issues/8454)): Allow Jupyter engine to handle markdown files with mixed-case extensions. - ([#8919](https://github.com/quarto-dev/quarto-cli/issues/8919)): Ensure enough backticks in `quarto convert` from `.ipynb` to `.qmd` files. +- ([#8998](https://github.com/quarto-dev/quarto-cli/issues/8998)): Interpret slide separation markers `---` correctly when creating the `.ipynb` intermediate notebook from a `.qmd` file. ## Website Listings diff --git a/src/core/jupyter/jupyter.ts b/src/core/jupyter/jupyter.ts index 6f383f0a4d6..9002f4d842d 100644 --- a/src/core/jupyter/jupyter.ts +++ b/src/core/jupyter/jupyter.ts @@ -427,9 +427,15 @@ export async function quartoMdToJupyter( inCodeCell = false, inCode = false, backtickCount = 0; - for (const line of lines(inputContent)) { + let currentLine = 0; + const contentLines = lines(inputContent); + for (currentLine = 0; currentLine < contentLines.length; ++currentLine) { + const line = contentLines[currentLine]; // yaml front matter - if (yamlRegEx.test(line) && !inCodeCell && !inCode) { + if ( + yamlRegEx.test(line) && !inCodeCell && !inCode && + contentLines[currentLine + 1]?.trim() !== "" // https://github.com/quarto-dev/quarto-cli/issues/8998 + ) { if (inYaml) { lineBuffer.push(line); flushLineBuffer("raw", !parsedFrontMatter); diff --git a/tests/docs/smoke-all/2024/03/22/8998.qmd b/tests/docs/smoke-all/2024/03/22/8998.qmd new file mode 100644 index 00000000000..bd9f5d5990a --- /dev/null +++ b/tests/docs/smoke-all/2024/03/22/8998.qmd @@ -0,0 +1,25 @@ +--- +title: "Habits" +author: "John Doe" +format: revealjs +engine: jupyter +_quarto: + tests: + revealjs: + - [] + - ["python"] +--- + +- Turn off alarm +- Get out of bed +- `{python} 1` + +--- + +- Get in bed +- Count sheep +- `{python} 2` + +--- + +Last slide to recreate the issue \ No newline at end of file