Skip to content

Commit 4505de4

Browse files
chrisbraivankra
andcommitted
runtime(rmd): fix typo in code block delimiter pattern, add test
Test file taken from https://github.com/rstudio/rmarkdown/blob/main/inst/rmarkdown/templates/github_document/skeleton/skeleton.Rmd fixes: #21328 Co-authored-by: Ivan Krasilnikov <[email protected]> Signed-off-by: Christian Brabandt <[email protected]>
1 parent f2ab425 commit 4505de4

5 files changed

Lines changed: 101 additions & 2 deletions

File tree

‎runtime/syntax/rmd.vim‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
" Former Maintainer: Jakson Alves de Aquino <[email protected]>
44
" Former Repository: https://github.com/jalvesaq/R-Vim-runtime
55
" Last Change: 2023 Dec 24 07:21AM
6-
" 2024 Feb 19 by Vim Project (announce adoption)
6+
" 2024 Feb 19 by Vim project (announce adoption)
7+
" 2026 Sep 29 by Vim project (fix typo in code block delimiter pattern)
78
"
89
" For highlighting pandoc extensions to markdown like citations and TeX and
910
" many other advanced features like folding of markdown sections, it is
@@ -134,7 +135,7 @@ endif
134135
" Step_3: Highlight code blocks.
135136

136137
syn region rmdCodeBlock matchgroup=rmdCodeDelim start="^\s*```\s*{.*}$" matchgroup=rmdCodeDelim end="^\s*```\ze\s*$" keepend
137-
syn region rmdCodeBlock matchgroup=rmdCodeDelim start="^\s*```.+$" matchgroup=rmdCodeDelim end="^```$" keepend
138+
syn region rmdCodeBlock matchgroup=rmdCodeDelim start="^\s*```.\+$" matchgroup=rmdCodeDelim end="^\s*```\ze\s*$" keepend
138139
hi link rmdCodeBlock Special
139140

140141
" Now highlight chunks:

‎runtime/syntax/testdir/dumps/rmd_01_00.dump‎

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎runtime/syntax/testdir/dumps/rmd_01_01.dump‎

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎runtime/syntax/testdir/dumps/rmd_01_02.dump‎

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
title: "Untitled"
3+
output: github_document
4+
---
5+
6+
```{r setup, include=FALSE}
7+
knitr::opts_chunk$set(echo = TRUE)
8+
```
9+
10+
## GitHub Documents
11+
12+
This is an R Markdown format used for publishing markdown documents to GitHub. When you click the **Knit** button all R code chunks are run and a markdown file (.md) suitable for publishing to GitHub is generated.
13+
14+
## Including Code
15+
16+
You can include R code in the document as follows:
17+
18+
```{r cars}
19+
summary(cars)
20+
```
21+
22+
## Including Plots
23+
24+
You can also embed plots, for example:
25+
26+
```{r pressure, echo=FALSE}
27+
plot(pressure)
28+
```
29+
30+
Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.
31+
32+
text
33+
34+
```sh
35+
code
36+
```
37+
38+
text

0 commit comments

Comments
 (0)