REditorSupport / vscode-R

R Extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=REditorSupport.r
MIT License
1.08k stars 129 forks source link

Is there a way to sync scroll rmd file and the compiled html file? #1502

Open jiangtianli91 opened 8 months ago

jiangtianli91 commented 8 months ago

For regular markdown file, vscode can sync it with the compiled html so that one can scroll them synchronously. I couldn't find a way to achieve that for rmarkdown in vscode. Is there a way to do so?

I have checked the setting for R and markdown in vscode, but cannot find a way to achieve it.

Fred-Wu commented 5 months ago

If you don't need codes to run, but just to view the text and math in HTML while you are writing, then in the settings.json, you could associate Rmd with markdown

    "files.associations": {
      "*.Rmd": "markdown",
      "*.rmd": "markdown",
    },

Then keyboard settings like below, will generate a plain version of HTML that could scroll with Rmd synchronously.

  {
    "key": "shift+alt+m",
    "command": "markdown.showPreviewToSide",
    "when": "editorTextFocus && editorLangId == 'rmd'"
  }