Rstudio appends \ character before multi-line inline code in visual editor mode

Team,

We use Rstudio 1.4 for our projects and found that it is appending the \ character before the multi-line inline codes when we switch from Source editor to Visual editor mode.
We have a condition that requires us to use this kind of multi-line inline statements in our R markdowns to represent this as a header and thus we couldn't bypass this.

image

Due to this appended character, we are facing issue s while knitting the document

Please let us know if any more details are needed.

1 Like

This is because the syntax used is inline R code and it is expected to be used inline. I am surprise this works in fact. The visual editor does not see recognize this as inline R code and so consider that the backtick is a raw one and it should be escape, hence the backslash.

If you want to conditionally include Markdown content spread on several line, I would greatly advice to use the asis chunk

---
title: "Demo"
output: html_document
---

```{r, include = FALSE}
print_header = FALSE
```

```{asis, echo = print_header}

# Hello World

```

See

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.