jonschlinkert / sublime-markdown-extended

Top 100 Sublime Text plugin! Markdown syntax highlighter for Sublime Text, with extended support for GFM fenced code blocks, with language-specific syntax highlighting. YAML Front Matter. Works with ST2/ST3. Goes great with Assemble.
https://github.com/jonschlinkert
MIT License
660 stars 96 forks source link

adding support for knitr R syntax ({r}, {r, opts} #26

Closed houshuang closed 11 years ago

houshuang commented 11 years ago

This adds support for Knitr (literate coding in R) code blocks, example:

jonschlinkert commented 11 years ago

nice! thanks again!

bachue commented 11 years ago

@houshuang Hello, I think your commit has influenced Ruby and all other languages whose name starts with r. Why not make your regex more accurate? e.g. r|\{r(,\s.+)?\}

HenrikEckermann commented 6 years ago

@houshuang 👍 Thanks! One thing I noticed is that knitr support is not there for python code chunks.

E.g typing:

```{python echo=TRUE} print('hello') ```

would neither support knitr chunk option highlighting, neither would the python code be highlighted.

The Python code only gets highlighted when curly brackets are left out but then you cannot really use it for creating documents with code output.

thosgood commented 2 years ago

This is still giving me some issues. I'm writing a .Rmd file that has such chunks in it, but the syntax highlighting can't seem to tell that the chunk has ended: after the first chunk in a document, the rest of the document continues to be highlighted as if it were still in the code chunk.

Screenshot 2022-07-03 at 02 21 22

(This screen shot isn't using the Monokai Extended colour scheme, but that gives exactly the same result).

I would be happy even to just disable highlighting for all code chunks to be honest — anything to get normal markdown highlighting back for the rest of the document! (Really it's worse than just highlighting: Sublime Text's "Goto symbol" command doesn't work to navigate around sections after the start of the code chunk anymore, and e.g. selecting some text and typing * no longer surrounds the selected text with asterisks but instead simply replaces it with a *, as you would expect in plain text mode).