You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the Markdown file can get a preview.
I believe R markdown file can also get a preview by calling preview command on Markdown.
I put this issue as the TODO
By adding the below to settings.json, you can use Markdown: Open Preview on R markdown files. It doesn't do anything special with the R code blocks, though.
Hi @rjBadger, as shown in the video above, the VSNotebooksBeta extension (a fork of the neuron extension) provides some support of R Markdown files, although there is a lot of room for improvement. I'd like to see work on R Markdown support for VSCode made on neuron or one of its forks, so that the improvements also benefit Julia etc. I'm not currently working on anything related to this, though.
That sounds great@renkun-ken! Would this also allow to show chunks of text, math, and or code separately? For an illustration of what I mean, see the GIF below:
Now that R session watcher is enabled by default in #670, how about adding a button that runs rmarkdown::run(file) and opens a tab, like the button that shows the VSCode default Markdown preview?
Reacted by Elian H. Thiele-Evans and Yuanjian Zhang
There is an issue with rmarkdown::run() that mathjax and syntax highlight are lost when the document is refreshed. Didn't have time to investigate at the moment. @ElianHugh Are you interested in digging into this?
text decoration disappears when the shiny app refreshes the content, not when the page is refreshed manually. i.e., if auto_reload = FALSE, and you refresh the page, the decoration will still be there
this issue is not specific to vscode-R, as I could replicate it in RStudio
xaringan::inf_mr does not have this problem (although it is slower to load at times)
Syntax highlighting is maintained if a specific highlight theme is declared in the yaml, e.g.
---
title: "My R Doc"output:
html_document:
highlight: kate
---
Activity
andycraig commentedon Apr 14, 2019
By adding the below to
settings.json, you can useMarkdown: Open Previewon R markdown files. It doesn't do anything special with the R code blocks, though.From https://qiita.com/yutannihilation/items/1f71c0fedae6e4b8038c
Ikuyadeu commentedon Apr 15, 2019
@andycraig Thank you! It is working well.
Ikuyadeu commentedon Apr 15, 2019
I can not use R markdown syntax and inline execution by this change.
We should call
Markdown: Open Previewas the R markdown mode.andycraig commentedon Apr 16, 2019
That's right, that change doesn't do anything special with R code blocks.
A better R markdown experience could be gained by adding a command that calls the
knitrpackage, and then previews a resulting HTML or PDF file (maybe using https://marketplace.visualstudio.com/items?itemName=hdg.live-html-previewer and https://marketplace.visualstudio.com/items?itemName=tomoki1207.pdf). This could be a Good First Issue.RStudio-like inline output from R code blocks would be tougher. I'm not sure if the VSCode editor supports non-text objects.
andycraig commentedon Apr 20, 2019
It looks like the neuron extension might be very helpful here:
https://marketplace.visualstudio.com/items?itemName=neuron.neuron-IPE
I haven't managed to get it running successfully yet though, and it sounds like others are having trouble too: neuron-team/vscode-ipe#187
I've had more success with this fork:
https://marketplace.visualstudio.com/items?itemName=pavan.VSNotebooksBeta
It connects to Jupyter and displays the output of R code sent to it.
andycraig commentedon Apr 24, 2019
Using VSNotebooks:
This setting was necessary to get VSNotebooks to recognise Rmd files:
RobJamesRamos commentedon Jul 12, 2019
Is this still being worked on? Rmarkdown support is one of the major reasons I don't switch to vscode.
andycraig commentedon Jul 14, 2019
Hi @rjBadger, as shown in the video above, the VSNotebooksBeta extension (a fork of the neuron extension) provides some support of R Markdown files, although there is a lot of room for improvement. I'd like to see work on R Markdown support for VSCode made on neuron or one of its forks, so that the improvements also benefit Julia etc. I'm not currently working on anything related to this, though.
andycraig commentedon Jul 15, 2019
There is an issue open for adding support for other languages to the (very good) Jupyter component of the Python extension. If you are interested in better notebook support for R, please consider voting for it here: https://github.com/microsoft/vscode-python/issues/5078#issuecomment-507751659
Thank you!
renkun-ken commentedon Dec 18, 2019
With #150, we can use
rmarkdown::run(file)to start an HTTP server to show an RMarkdown document, instantly.vnijs commentedon Dec 18, 2019
That sounds great @renkun-ken! Would this also allow to show chunks of text, math, and or code separately? For an illustration of what I mean, see the GIF below:
adamaltmejd commentedon Feb 25, 2021
Would love to have a pdf preview option as well.
eitsupi commentedon Jun 28, 2021
Now that R session watcher is enabled by default in #670, how about adding a button that runs
rmarkdown::run(file)and opens a tab, like the button that shows the VSCode default Markdown preview?ElianHugh commentedon Jun 29, 2021
I wonder if it's possible to have
runas a task, so that it's non-blocking. Hmm... Live preview would be very neat ;)ElianHugh commentedon Jun 30, 2021
I've tinkered with this idea a bit. A little proof of concept:

renkun-ken commentedon Jun 30, 2021
There is an issue with
rmarkdown::run()that mathjax and syntax highlight are lost when the document is refreshed. Didn't have time to investigate at the moment. @ElianHugh Are you interested in digging into this?ElianHugh commentedon Jun 30, 2021
Ah, I see what you mean - happy to look into it!
Edit:
A couple of observations:
auto_reload = FALSE, and you refresh the page, the decoration will still be therexaringan::inf_mrdoes not have this problem (although it is slower to load at times)Syntax highlighting is maintained if a specific highlight theme is declared in the yaml, e.g.
ElianHugh commentedon Jul 21, 2021
Closed by #692.