5

I would like to enable syntax highlighting for R Markdown (.Rmd) highlighting in TextWrangler. I managed to get syntax highlighting for .R files using this R.plist file (direct link to file). R Markdown has similar highlighting, so I have that file as a starting point, as I cannot find a similar .plist file for .Rmd files.

The issue I am having is that in RMarkdown, the code is between a set of ``` (three backticks) and the text (which is what I'd like to demarcate as comments) are the remainder of the file.

I would like to tell TextWrangler to only highlight what it sees between a set of ``` - currently, it highlights the entire file (including my text sections).

I thought editing the values for keys

<key>Open Block Comments</key>
        <string></string>
<key>Close Block Comments</key>
        <string>```</string>

would be a workaround, but it doesn't seem to help.

Edit, here is the Rmd syntax:

here is some text that is whatever I want.

```
in here between the backticks is some code 
```
here is some more exposition

The code I'd like to highlight with R syntax is between backticks, whereas the text I'd like to display as a comment/without highlighting (whichever is easiest) is not demarcated.

blep
  • 726
  • 1
  • 11
  • 28
  • I probably don't understand Rmd very well since I would have suggested: `Open Block Comments 3backticks`. You may need to figure out whether the BBEdit parser lets you use multiple characters to define a code block with something analogus to what it is using with quotes: `Open Strings 1 "` and `Close Strings 2 '` – IRTFM Jun 22 '15 at 23:32
  • @BondedDust I added an "example" that hopefully clarifies the Rmd syntax. The issue, I think, is that the code is demarcated by ``` whereas the text (which I'd like to either have as a comment or not highlighted at all - currently the highlighting is picking up every "for," "data," etc. in the text) is not set apart by anything at all. My idea was to have it think everything until the ``` was a comment, and then read the rest as code, but this is flawed because I need some marker of the start of the text. – blep Jun 23 '15 at 00:06
  • I found the [specification](http://www.barebones.com/support/develop/clm.html) for the file I am trying to create, but it may be some time before I hit upon a solution myself. – blep Jun 23 '15 at 00:10
  • 1
    I had found that as well. The C-language comment block example may be what you want to emulate. Uses '/*' and '*/" to delineate "comment blocks". – IRTFM Jun 23 '15 at 00:22
  • Did you find a solution for this? I also could not find anything. – Rainer Jul 04 '19 at 08:47

0 Answers0