Quarto inserts random backslashes in visual mode editor #1963
Replies: 4 comments 9 replies
-
Those slashes are added by Pandoc when we round trip the source through its internal representation. Backslashes in markdown simply ensure that the characters are not interpreted as e.g. an equation. |
Beta Was this translation helpful? Give feedback.
-
I'm not sure what's happening in your local environment but I am not able to reproduce any of this with the latest version of RStudio IDE. Note that I modified your source code to remove the escaping for This is BTW an RStudio IDE issue not a quarto-cli issue so you should report it there. If you can provide the absolute minimum qmd document that exhibits the problem that will be extremely helpful. You should provide the source to a document that loads correctly in the visual editor (i.e. has no escaping) which then consistently has incorrect escaping added on transforming back to source. |
Beta Was this translation helpful? Give feedback.
-
It's OK. I'll just stick to the source editor for now. Maybe it will go away on its own with a future update. I will note that I have experienced the issue on two separate PCs both running the most recent version of R Studio. But it is something that occurs intermittently and not something that I can reproduce in a way that someone could easily troubleshoot. I just thought I'd check to see if other people were having the same issue. Thanks for your help. |
Beta Was this translation helpful? Give feedback.
-
@eteitelbaum This is definitely a thing. I work with LaTeX with the visual editor and have run into this too. In fact I was warned by a colleague "Watch out, the visual editor trashes LaTeX." For work, I am careful to stick with the source editor, but for teaching Quarto I do want to use the visual editor. My most common issue happens when I don't have a blank space between text and display math. If I had a blank line between the text and display math, it won't happen. But LaTeX users remove the blank lines so that LaTeX doesn't interpret lines after an equation as a new paragraph and add indentation + extra spacing. In general though, I have personally found that Pandoc is too destructive to $$ .. $$. If you look at the TeX is generates, it added random extra blank lines before the equation, thus causing LaTeX to interpret the equation and next sentences as new paragraphs (with all the indentation and par spacing that comes with that). So I tend to use Before switching to visual editor: After switching the visual and then back to source: I am not happy that it changed |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
When I am editing in visual mode, I am noticing that occasionally Quarto is inserting random backslashes into the text. These don't show up in the visual mode editor but I can see them when I switch over to the source mode. So here is an example:
I wrote:
($y$%)
But Quarto turned it into:
(\$y\$%)
I also notice this happening when I am cutting and pasting stuff from an older R Markdown document. If I am in visual mode and I try to past a bunch of stuff I see random forward slashes in front of every line. I don't have a reproducible example of this, just something I have experienced in the past.
Are these supposed to be escape characters? Why is Quarto inserting them?
Beta Was this translation helpful? Give feedback.
All reactions