I’m trying to convert this new definition (a # followed by text, some of which might be wrapped in *) into the tmLanguage format, but I can’t figure out how to do it:
contexts:
main:
- match: '^#+' # headers
push:
- meta_scope: entity.name.function
- include: bold
- match: $\n? # \n is matched to render the remainder of the line in background color
pop: true
- include: bold
- match: (#).*$\n? # regular comments
scope: comment.line.number-sign.r
bold:
- match: \*
push:
- meta_content_scope: keyword.bold
- match: \*
pop: true
So far, I have :
<dict>
<key>match</key>
<string>(#) .*$\n?</string>
<key>name</key>
<string>comment.line.number-sign.rmd</string>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.comment.rmd</string>
</dict>
</dict>
</dict>
<dict>
<key>match</key>
<string>\*[^*]+\*</string>
<key>name</key>
<string>keyword.rmd</string>
</dict>
However, it doesn’t work.