Skip to content

Documentation Code Blocks with text on the line after turn into Base64 in the visual editor #718

Open
@houseofduchesses

Description

@houseofduchesses

Bug description

I've been dealing with this problem for a little while- when you create a documentation code block in the source editor by using two braces ( {{r}} ), if there is text on the line immediately after it, when you switch to the Visual Editor, the entire code block will be turned into what I'm pretty sure is Base64. All lines after will be collapsed to be on the same line as it, until there is another break in text. If there is nothing on the line after the code block, nothing will happen.

If you switch back to the source editor, the text will be the same; it is permanently changed. Regular code blocks do not exhibit this behavior no matter what text is after them.

Steps to reproduce

---
title: Hello World
format: html
---

```{{r}}
print("Hello World")
```

This is fine



```{{r}}
print("Hello World")
```
This isn't fine
Or this

This is safe

Paste in the source editor, then switch to visual, or just paste in visual editor.

Actual behavior

```{r}
print("Hello World")
```

This is fine

31b8e172-b470-440e-83d8-e6b185028602:dAB5AHAAZQA6AE8AUQBCAGoAQQBHAEkAQQBOAHcAQQA1AEEARwBVAEEATgBnAEIAagBBAEMAMABBAE8AQQBBADQAQQBEAGcAQQBaAEEAQQB0AEEARABRAEEAWQBRAEEAdwBBAEcAVQBBAEwAUQBBADUAQQBHAE0AQQBPAFEAQgBpAEEAQwAwAEEAWgBnAEIAbQBBAEQAWQBBAE4AdwBCAGoAQQBHAFEAQQBOAEEAQQB3AEEARABRAEEAWgBRAEEAMgBBAEQAQQBBAAoAcABvAHMAaQB0AGkAbwBuADoATwBRAEEAdwBBAEEAPQA9AAoAcAByAGUAZgBpAHgAOgAKAHMAbwB1AHIAYwBlADoAWQBBAEIAZwBBAEcAQQBBAGUAdwBCADcAQQBIAEkAQQBmAFEAQgA5AEEAQQBvAEEAYwBBAEIAeQBBAEcAawBBAGIAZwBCADAAQQBDAGcAQQBJAGcAQgBJAEEARwBVAEEAYgBBAEIAcwBBAEcAOABBAEkAQQBCAFgAQQBHADgAQQBjAGcAQgBzAEEARwBRAEEASQBnAEEAcABBAEEAbwBBAFkAQQBCAGcAQQBHAEEAQQAKAHMAdQBmAGYAaQB4ADoA:31b8e172-b470-440e-83d8-e6b185028602 This isn't fine Or this

This is safe

Expected behavior

Documentation code blocks should remain as they are regardless of what is on the next line.

Your environment

R version 4.4.2 (2024-10-31 ucrt)
RStudio Version 2025.05.0, Build 496
Quarto version 1.6.42

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions