tree-sitter-grammars / tree-sitter-markdown

Markdown grammar for tree-sitter
MIT License
379 stars 45 forks source link

comma in info string prevents language specific parsing of code block #38

Closed fisher-j closed 1 year ago

fisher-j commented 2 years ago

I really appreciate code parsing in fenced code blocks. In Rmarkdown, the language identifier (r) is often followed by a comma and further "chunk options". The comma prevents the language from being recognized. Could we allow comma in addition to whitespace after language identifier?

```{r, fig.height=4, fig.width=7}
x <- rnorm(100)                  # no syntax highlighting in these blocks
plot(x)
```

```{r chunk-name, fig.height=4, fig.width=7}
x <- rnorm(100)                  # this block has proper highlighting
plot(x)
```
jmbuhr commented 2 years ago

Until this is possible, you can use the the new way of specifying chunk options via the #| comment (https://yihui.org/knitr/options/#chunk-options , https://quarto.org/docs/computations/r.html)