Repository navigation
Open
Labels
bugvisual markdownFor bugs related to the new visual editor mode added for RMarkdown docs in the 1.4 release.
Milestone
Description
System details
RStudio Edition : Desktop
RStudio Version : Version 2024.04.0-daily+534 (2024.04.0-daily+534)
OS Version : macOS Sonoma 14.2.1
x86_64-apple-darwin20 (64-bit)
R Version : 4.3.3 (2024-02-29)
Steps to reproduce the problem
- Clone https://github.com/setgree/vegan-meta
- open vegan-meta.Rproj
- open vegan-meta.Rmd
- render in source mode (should work if you've got my libraries -- see below)
- switch to visual and back
- try to render
- get errors
Describe the problem in detail
Switching from source to visual -- even if I click the button by accident -- produces breaking changes in rendering because it's adding a bunch of backslashes (I guess it's trying to make sure things are formatted consistently?) but it's doing so in the middle fo R objects that Rstudio that is trying to evaluate.
Example:
Quitting from lines 296-297 (vegan-meta.Rmd)
Error:
! Failed to parse the inline R code: `r sum(self_report_outcomes\$outcome_category == "self_reported_more_less_outcome")\`
Reason: <text>:1:25: unexpected '\\'
1: sum(self_report_outcomes\
^
Backtrace:
1. FUN(X[[i]], ...)
2. rmarkdown::render(input = file, envir = parent.frame())
3. knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)
4. knitr:::process_file(text, output)
9. knitr:::process_group.inline(group)
...
14. base::tryCatch(...)
15. base (local) tryCatchList(expr, classes, parentenv, handlers)
16. base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
17. value[[3L]](cond)
18. knitr:::stop2(...)
Related: #8073
Describe the behavior you expected
There should not be breaking changes depending on how you use the editor 😃
- [ x] I have read the guide for submitting good bug reports.
- [ x] I have installed the latest version of RStudio, and confirmed that the issue still persists.
- [ x] If I am reporting an RStudio crash, I have included a diagnostics report.
- [x ] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
sessionInfo
b/c this paper takes a lot of libraries -- the core ones are tidyverse and metafor
> sessionInfo()
R version 4.3.3 (2024-02-29)
Platform: x86_64-apple-darwin20 (64-bit)
Running under: macOS Sonoma 14.2.1
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/lib/libRlapack.dylib; LAPACK version 3.11.0
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
time zone: America/New_York
tzcode source: internal
attached base packages:
[1] stats graphics grDevices utils datasets methods
[7] base
other attached packages:
[1] googledrive_2.1.1 dplyr_1.1.4 stringr_1.5.1
[4] sessioninfo_1.2.2 purrr_1.0.2 knitr_1.45
[7] metafor_4.6-0 numDeriv_2016.8-1.1 metadat_1.2-0
[10] Matrix_1.6-5
loaded via a namespace (and not attached):
[1] rappdirs_0.3.3 sass_0.4.8 utf8_1.2.4
[4] generics_0.1.3 stringi_1.8.3 lattice_0.22-5
[7] digest_0.6.34 magrittr_2.0.3 evaluate_0.23
[10] grid_4.3.3 bookdown_0.38 papaja_0.1.2.9000
[13] fastmap_1.1.1 rprojroot_2.0.4 jsonlite_1.8.8
[16] tinylabels_0.2.4 httr_1.4.7 fansi_1.0.6
[19] scales_1.3.0 jquerylib_0.1.4 cli_3.6.2
[22] rlang_1.1.3 munsell_0.5.0 withr_3.0.0
[25] cachem_1.0.8 yaml_2.3.8 tools_4.3.3
[28] gargle_1.5.2 colorspace_2.1-0 ggplot2_3.5.0
[31] mathjaxr_1.6-0 here_1.0.1 curl_5.2.1
[34] vctrs_0.6.5 R6_2.5.1 lifecycle_1.0.4
[37] fs_1.6.3 pkgconfig_2.0.3 gtable_0.3.4
[40] pillar_1.9.0 bslib_0.6.1 glue_1.7.0
[43] xfun_0.42 tibble_3.2.1 tidyselect_1.2.0
[46] rstudioapi_0.15.0 htmltools_0.5.7 nlme_3.1-164
[49] rmarkdown_2.25 compiler_4.3.3 askpass_1.2.0
[52] openssl_2.1.1
### Tasks
Metadata
Metadata
Assignees
Labels
bugvisual markdownFor bugs related to the new visual editor mode added for RMarkdown docs in the 1.4 release.
Activity
[-]switching between source and visual editors introduces a bunch of slashes that break rendering[/-][+]switching between source and visual editors introduces slashes in inline, evaluated R objects that break rendering[/+][-]switching between source and visual editors introduces slashes in inline, evaluated R objects that break rendering[/-][+]switching between source and visual modes introduces slashes in inline, evaluated R objects that break rendering[/+]setgree commentedon Apr 2, 2024
cc @ronblum
ronblum commentedon Apr 2, 2024
🙂
Thanks for bringing the issue over! I tried the code in both RStudio Desktop RStudio-2023.12.1-402 and 2024.04.0-daily+668 on Windows 11, but the back-and-forth switch works correctly. I only get the slashes after (incorrectly) removing the backticks.
I'll try on MacOS next, but do you know if this worked for you in previous versions of RStudio?
setgree commentedon Apr 3, 2024
IDK, I only recently started trying to compose reproducible documents in Rstudio.
I just saved everything, committed, then switched to visual and back to source and saved again, and committed: setgree/vegan-meta@da6aaba
Everything in this commit is unexpected behavior, IMO
setgree commentedon Sep 18, 2024
👋 just writing in to say I can reproduce this today on this document.
I am in source mode, it works, I can knit.
I switch to visual mode, and Rstudio inserts a random slash in an inline R object. Here is a commit showing with the change happening. (All I did was switch to visual mode).
After that, I can't knit until I delete the slash again.
I also notice that there are some typos in my original sentence:
The ` characters are off. So maybe the visual mode editor is trying to fix this by putting in
\characters but then it ends up not knitting? In effect, it's alerting me to a mistake that I made, just in a very roundabout way 😃 😃setgree commentedon Oct 24, 2024
Here is a commit where I made no changes to the document besides switching from source to visual in Rstudio and clicking save