rstudio / rstudio

RStudio is an integrated development environment (IDE) for R
https://posit.co/products/open-source/rstudio/
Other
4.68k stars 1.09k forks source link

html tag `<!--` inserted when commenting out bash code instead of `#` #10800

Open b4D8 opened 2 years ago

b4D8 commented 2 years ago

Hi there,

I noticed that bash comments are not handled correctly in code chunks. I'm not sure which project is responsible for the situation (rmarkdown, rstudio, something else?). I submit it here since comments are well handled in .sh files in rstudio.

Reproducible example

  1. Create an Rmd file (I used github_template but any output will do)
  2. Insert the following code chunk:
```{bash}
echo hello world

3. comment the line out with the `CTRL+SHIFT+C` shortcut

### Actual result
<!-- echo hello world -->
### Expected result
#echo hello world

## Session info

R version 4.1.3 (2022-03-10) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Debian GNU/Linux 11 (bullseye), RStudio 2022.2.0.443

Locale: LC_CTYPE=fr_FR.UTF-8 LC_NUMERIC=C LC_TIME=fr_FR.UTF-8 LC_COLLATE=fr_FR.UTF-8 LC_MONETARY=fr_FR.UTF-8 LC_MESSAGES=fr_FR.UTF-8
LC_PAPER=fr_FR.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=fr_FR.UTF-8 LC_IDENTIFICATION=C

Package version: base64enc_0.1.3 bslib_0.3.1 digest_0.6.29 evaluate_0.15 fastmap_1.1.0 fs_1.5.2 glue_1.6.2 graphics_4.1.3 grDevices_4.1.3 highr_0.9
htmltools_0.5.2 jquerylib_0.1.4 jsonlite_1.8.0 knitr_1.37 magrittr_2.0.2 markdown_1.1 methods_4.1.3 mime_0.12 R6_2.5.1 rappdirs_0.3.3 rlang_1.0.2 rmarkdown_2.13 sass_0.4.0 stats_4.1.3 stringi_1.7.6 stringr_1.4.0 tinytex_0.37 tools_4.1.3 utils_4.1.3 xfun_0.30
yaml_2.3.5

Pandoc version: 2.17.1.1



## Checklist

When filing a _bug report_, please check the boxes below to confirm that you have provided us with the information we need. Have you:
- [x] [formatted your issue](https://yihui.org/issue/#please-format-your-issue-correctly) so it is easier for us to read?
- [x] included a minimal, self-contained, and reproducible example?
- [x] pasted the output from `xfun::session_info('rmarkdown')` in your issue?
- [x] upgraded all your packages to their latest versions (including your versions of R, the RStudio IDE, and relevant R packages)?
- [x] installed and tested your bug with the development version of the rmarkdown package using `remotes::install_github("rstudio/rmarkdown")`?
cderv commented 2 years ago

As this is an issue regarding keyboard shortcut in the RSTUDIO IDE, I think it should be reported there.

There is nothing we can do on rmarkdown side about that unfortunately.

@kevinushey are you able to move this issue there ?

Thanks

ronblum commented 2 years ago

Reproducible in RStudio Desktop 2022.06.0+198 on MacOS 12.3.

Note: This is in source mode only, and works correctly in visual mode.

Yiguan commented 2 years ago

Really annoying to comment out bash code in Rmarkdown!! I post the issue long time ago and it seems not solved yet...

I change bash tag to r everytime I want to comment out bash code, it's silly....

I am waiting for a solution!

ronblum commented 2 years ago

@Yiguan Thank you for raising this. Unfortunately, we have many issues—both enhancements and bugs—to consider, and we prioritize them based on impact. One of the ways in which we measure this is by the number of upvotes in the original post. So, a way to get this higher up in the queue would be to encourage more people who have the same or similar request to give a 👍 in the first message.

kevinushey commented 1 year ago

FWIW, now that R Markdown supports the 'comment' engine, an easy way to comment out any engine is to change the name to comment.

Sherry520 commented 1 year ago

When I pasted the code commented with <!-- , error occurred: image