New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nested fenced code block messes up source highlighting in the editor #10079
Comments
|
Reproducible with older versions of RStudio as well, going back to RStudio Desktop 1.2.5042 on MacOS 12. |
|
I believe supporting this will require a few changes. First, the chunk highlighter would need to become stateful, and track the number of backticks used in each chunk header / footer. That implementation lives here: Second, the Ace highlight rules would need to become stateful as well. Those rules are activated here: rstudio/src/gwt/acesupport/acemode/rmarkdown_highlight_rules.js Lines 58 to 66 in 686bc16
And the rstudio/src/gwt/acesupport/acemode/utils.js Lines 98 to 143 in 686bc16
The |
System details
Steps to reproduce the problem
Open a new rmarkdown document and paste the following content
Describe the problem in detail
The source editor will not correctly recognized the nested chunk and it will mess up the highlighting

Example with the code chunk not being correctly highlighted, and headers not correctly found after the chunk.
Describe the behavior you expected
This syntax is something rather new in knitr. Last version support nested chunks and some engine will benefit from this like the
commentengine or theverbatimengine.WIth the current IDE behavior, it is rather hard to write and read such content.
I would expect the highlighting of the Markdown document in the IDE to be the same as without nested chunk.
cc @yihui
The text was updated successfully, but these errors were encountered: