quarto-dev / quarto-dev/quarto

Roundtripping with `:::` div and code cell removes necessary blank line

Open
#884 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug visual-editor
Dominant language
TypeScript
Stars
645
Forks
62
Avg merge
17h 42m
Merged PRs (30d)
13

Description

In https://github.com/posit-dev/positron/issues/11205 we have a report of some problems round-tripping between visual and source mode.

If you have .qmd syntax like this, with the needed blank lines around the code cell inside the callout box:

---
title: "My simple Quarto file"
format: html
---

## Make a plot

You can embed plots in a Quarto file, for example:

::: callout-tip
## Tip with Title

This is an example of a callout with a title.

```{r}
#| echo: false
plot(faithful)
```

:::

## Cool math

Or you can do simple calculations:

```{r}
1 + 1
```

Then switch to visual mode, then switch back to source mode, you lose the blank line after the code cell, to get this:

---
title: "My simple Quarto file"
format: html
---

## Make a plot

You can embed plots in a Quarto file, for example:

::: callout-tip
## Tip with Title

This is an example of a callout with a title.

```{r}
#| echo: false
plot(faithful)
```
:::

## Cool math

Or you can do simple calculations:

```{r}
1 + 1
```

This is a pretty significant problem, because now we run into the parsing problems when you don't have those kind of blank lines around code cells such as outlined in https://github.com/quarto-dev/quarto/issues/493.

Contributor guide

No contributing guide indexed for this repository

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.

Research direction

Reproduce issue 884 with the provided .qmd example by switching from source mode to visual mode and back. Compare the resulting callout and code-cell boundaries with the original, and review the related reports in posit-dev/positron#11205 and quarto-dev/quarto#493. Done means the blank line after the code cell is preserved and the resulting document avoids the reported parsing problems.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.