'RStudio: Switch markdown editing mode between Source and Visual changes special characters
I experienced that for RStudio 2022.02.1 Build 461
, switching markdown editing mode between Source and Visual changes special character
to .
. It can be observed by switching markdown editing mode from Source
to Visual
and then back to Source
. Wondering how to prevent this rstudio behavior?
Code
---
title: "Test Slides"
format:
revealjs:
chalkboard:
buttons: false
preview-links: auto
css: styles.css
---
## Intro
- This is a test 1.
- This is a test 2.
sessionInfo()
R version 4.1.3 (2022-03-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 22000)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets
[6] methods base
loaded via a namespace (and not attached):
[1] compiler_4.1.3 tools_4.1.3 knitr_1.38
[4] xfun_0.30 pacman_0.5.1
Solution 1:[1]
The visual editor will by default rewrite markdown for you in the canonical way expected by Pandoc Markdow. $nbsp;
is a non breaking space in HTML. It get transformed in the source are the non breaking space character in markdown.
See https://rstudio.github.io/visual-markdown-editing/content.html#non-breaking-spaces
If you don't want that the source are rewritten, you can deactivate canonical mode per file or for project / global option. See https://rstudio.github.io/visual-markdown-editing/markdown.html#canonical-mode and https://rstudio.github.io/visual-markdown-editing/options.html#global-options
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | cderv |