Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Stata & R support in fenced code blocks #73

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion Note-fenced.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ contexts:
- include: fenced-scss
- include: fenced-shell
- include: fenced-sql
- include: fenced-stata
- include: fenced-tex
- include: fenced-xml
- include: fenced-yaml
Expand Down Expand Up @@ -296,12 +297,13 @@ contexts:
pop: true
- include: scope:source.python
fenced-r:
- match: '((?:^|\G)\s*[`~]{3,})\s*(r)\s*$'
- match: '((?:^|\G)\s*[`~]{3,})\s*(r|{r}|{r(\s|\,).*})\s*$'
captures:
1: punctuation.definition.raw.block.fenced.markdown
2: meta.definition.language.raw.block.fenced.markdown
push:
- meta_scope: markup.raw.block.markdown markup.raw.block.fenced.markdown meta.language.r
- meta_content_scope: source.r
- match: '^(\1)[ \t]*(\n|$)'
captures:
1: punctuation.definition.raw.block.fenced.markdown
Expand Down Expand Up @@ -399,6 +401,20 @@ contexts:
2: meta.definition.language.raw.block.fenced.markdown
pop: true
- include: scope:source.sql
fenced-stata:
- match: '((?:^|\G)\s*[`~]{3,})\s*(s|stata|{s}|{s(\s|\,).*}|{stata}|{stata(\s|\,).*})\s*$'
captures:
1: punctuation.definition.raw.block.fenced.markdown
2: meta.definition.language.raw.block.fenced.markdown
push:
- meta_scope: markup.raw.block.markdown markup.raw.block.fenced.markdown meta.language.stata
- meta_content_scope: source.stata
- match: '^(\1)[ \t]*(\n|$)'
captures:
1: punctuation.definition.raw.block.fenced.markdown
2: meta.definition.language.raw.block.fenced.markdown
pop: true
- include: scope:source.stata
fenced-tex:
- match: '((?:^|\G)\s*[`~]{3,})\s*(tex)\s*$'
captures:
Expand Down
36 changes: 35 additions & 1 deletion Note-fenced.tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,36 @@
</array>
</dict>

<key>fenced-stata</key>
<dict>
<key>begin</key>
<string>((?:^|\G)\s*[`~]{3,})\s*(s|stata|{s}|{s(\s|\,).*}|{stata}|{stata(\s|\,).*})\s*$</string>
<key>end</key>
<string>^(\1)[ \t]*(\n|$)</string>
<key>name</key>
<string>markup.raw.block.markdown markup.raw.block.fenced.markdown meta.language.stata</string>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.raw.block.fenced.markdown</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>meta.definition.language.raw.block.fenced.markdown</string>
</dict>
</dict>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>source.stata</string>
</dict>
</array>
</dict>

<key>fenced-shell</key>
<dict>
<key>begin</key>
Expand Down Expand Up @@ -624,7 +654,7 @@
<key>fenced-r</key>
<dict>
<key>begin</key>
<string>((?:^|\G)\s*[`~]{3,})\s*(r)\s*$</string>
<string>((?:^|\G)\s*[`~]{3,})\s*(r|{r}|{r(\s|\,).*})\s*$</string>
<key>end</key>
<string>^(\1)[ \t]*(\n|$)</string>
<key>name</key>
Expand Down Expand Up @@ -1004,6 +1034,10 @@
<key>include</key>
<string>#fenced-sql</string>
</dict>
<dict>
<key>include</key>
<string>#fenced-stata</string>
</dict>
<dict>
<key>include</key>
<string>#fenced-shell</string>
Expand Down