Hi,
I’m trying to create a new syntax definition for DokuWiki (.txt) files as the existing plugin doesn’t work and I thought I’d have a go at it myself to learn.
As with many languages, there are recursive elements to be highlighted.
Eg. //hello world//
In the above, // … // denotes italics, and ** … ** denotes bold begin/end boundaries.
In ST3, I would like the above example to appear in italics AND bold, but I can only get it to do one or the other.
In my .tmLanguage file I have the following definition (yes, I’m coding directly in xml not JSON)…
<dict>
<key>comment</key>
<string>//italic text//</string>
<key>begin</key>
<string>(//)</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>container.inline.dokuwiki_st3</string>
</dict>
</dict>
<key>end</key>
<string>(.*)(//)</string>
<key>endCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>italic.dokuwiki_st3</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>container.inline.dokuwiki_st3</string>
</dict>
</dict>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#inline</string>
</dict>
</array>
</dict>
I also have another ‘identical’ definition to match the bold settings.
I’m a newbie in regular expressions, but any help in allowing both bold AND italics to be applied would be much appreciated. I had assumed that the ‘include #inline’ would have caused this recursion automatically, but apparently not.
Thanks.