Skip to content
Open
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
131 changes: 118 additions & 13 deletions Syntaxes/Markdown Extended.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,85 @@ contexts:
pop: true
- match: "--"
scope: invalid.illegal.bad-comments-or-CDATA.html

pandoc-figref:
- match: '(\[)(-?@fig:)(\S*)(\])|(?<=\s|^)(@fig:)(\S*)(?=\s)'
captures:
0: figref.pandoc
1: punctuation.figref.begin.pandoc
2: punctuation.string.other.figref.type.pandoc
3: string.other.figref.desc.pandoc
4: punctuation.figref.end.pandoc
5: string.other.figref.type.pandoc
6: string.other.figref.desc.pandoc
pandoc-secref:
- match: '(\[)(-?@sec:)(\S*)(\])|(?<=\s|^)(@sec:)(\S*)(?=\s)'
captures:
0: secref.pandoc
1: punctuation.secref.begin.pandoc
2: string.other.secref.type.pandoc
3: string.other.secref.desc.pandoc
4: punctuation.secref.end.pandoc
5: string.other.secref.type.pandoc
6: string.other.secref.desc.pandoc
pandoc-eqref:
- match: '(\[)(-?@eq:)(\S*)(\])|(?<=\s|^)(@eq:)(\S*)(?=\s)'
captures:
0: eqref.pandoc
1: punctuation.eqref.begin.pandoc
2: string.other.eqref.type.pandoc
3: string.other.eqref.desc.pandoc
4: punctuation.eqref.end.pandoc
5: string.other.eqref.type.pandoc
6: string.other.eqref.desc.pandoc
pandoc-tblref:
- match: '(\[)(-?@tbl:)(\S*)(\])|(?<=\s|^)(@tbl:)(\S*)(?=\s)'
captures:
0: tblref.pandoc
1: punctuation.tblref.begin.pandoc
2: string.other.tblref.type.pandoc
3: string.other.tblref.desc.pandoc
4: punctuation.tblref.end.pandoc
5: string.other.tblref.type.pandoc
6: string.other.tblref.desc.pandoc

pandoc-tbllabel:
- match: '(Table:|\:)(.*?)(\{)(\#tbl:)(\S+)(\})'
captures:
0: table.pandoc
1: punctuation.table.begin.pandoc
2: string.other.tbllabel.header.pandoc
3: punctuation.tbllabel.begin.pandoc
4: string.other.tbllabel.type.pandoc
5: string.other.tbllabel.name.pandoc
6: punctuation.tbllabel.end.pandoc

pandoc-eqlabel:
- match: '(?<=\\\] )(\{)(\#eq:)(\S+)(\})((?= \w)|(?=\s))'
captures:
0: eqlabel.pandoc
1: punctuation.eqlabel.begin.pandoc
2: string.other.eqlabel.type.pandoc
3: string.other.eqlabel.name.pandoc
4: punctuation.eqlabel.end.pandoc

pandoc-citation:
- match: '(?<!\!)(\[)(\w*\s*)?(@)(?!fig:)(?!eq:)(?!tbl:)(.*)(?:(\, )(?:(?:(.*?)(; )(.*?)(]))|(?:(.*?)(])))|(]))'
captures:
0: punctuation.citation.pandoc
1: punctuation.citation.begin.pandoc
2: string.other.citation.pre.pandoc
3: punctuation.citation.at.pandoc
4: string.other.citation.name.pandoc
5: punctuation.citation.comma.pandoc
6: punctuation.citation.post.pandoc
7: punctuation.citation.semicomma.pandoc
8: string.other.citation.multi.pandoc
9: punctuation.citation.end.pandoc
10: string.other.citation.post.pandoc
11: punctuation.citation.end.pandoc
12: punctuation.citation.end.pandoc

ampersand:
- match: "&(?!([a-zA-Z0-9]+|#[0-9]+|#x[0-9a-fA-F]+);)"
comment: |
Expand Down Expand Up @@ -946,6 +1025,16 @@ contexts:
escape:
- match: '\\[-`*_#+.!(){}\[\]\\>]'
scope: constant.character.escape.markdown

pandoc-seclabel:
- match: '(\{)(#sec:)(.*)(\})'
captures:
0: seclabel.pandoc
1: punctuation.seclabel.begin.pandoc
2: seclabel.seclabel.pandoc
3: seclabel.name.pandoc
4: punctuation.seclabel.end.pandoc

heading:
- match: '\G(#{1})(?!#)\s*(?=\S)'
captures:
Expand Down Expand Up @@ -1011,7 +1100,7 @@ contexts:
- match: |-
(?x:
\! # Images start with !
(\[)((?<square>[^\[\]\\]|\\.|\[\g<square>*+\])*+)(\])
(\[)((?<square>[^\[\]\\]|\\.|\[(\g<square>*+)\])*+)(\])
# Match the link text.
([ ])? # Space not allowed
(\() # Opening paren for url
Expand All @@ -1023,24 +1112,31 @@ contexts:
)? # Title is optional
\s* # Optional whitespace
(\))
)
)(?:(\{)((\#fig:)(\S+)(?:(\ )(\S+))?)(\}))?
scope: meta.image.inline.markdown
captures:
1: punctuation.definition.string.begin.markdown
2: string.other.link.description.markdown
4: punctuation.definition.string.end.markdown
5: invalid.illegal.whitespace.markdown
6: punctuation.definition.metadata.markdown
7: punctuation.definition.link.markdown
8: markup.underline.link.image.markdown
9: punctuation.definition.link.markdown
10: string.other.link.description.title.markdown
11: punctuation.definition.string.markdown
4: ref.link.description.markdown
5: punctuation.definition.string.end.markdown
6: invalid.illegal.whitespace.markdown
7: punctuation.definition.metadata.markdown
8: punctuation.definition.link.markdown
9: markup.underline.link.image.markdown
10: punctuation.definition.link.markdown
11: string.other.link.description.title.markdown
12: punctuation.definition.string.markdown
13: string.other.link.description.title.markdown
14: punctuation.definition.string.markdown
13: punctuation.definition.string.markdown
14: string.other.link.description.title.markdown
15: punctuation.definition.string.markdown
16: punctuation.definition.metadata.markdown
16: punctuation.definition.string.markdown
17: punctuation.definition.metadata.markdown
18: punctuation.figlabel.begin.pandoc
19: string.other.figlabel.pandoc
20: string.other.figlabel.type.pandoc
21: string.other.figlabel.name.pandoc
23: string.other.figlabel.attributes.pandoc
24: punctuation.figlabel.end.pandoc
image-ref:
- match: '\!(\[)((?<square>[^\[\]\\]|\\.|\[\g<square>*+\])*+)(\])[ ]?(\[)(.*?)(\])'
scope: meta.image.reference.markdown
Expand All @@ -1052,6 +1148,15 @@ contexts:
6: constant.other.reference.link.markdown
7: punctuation.definition.constant.markdown
inline:
- include: pandoc-figref
- include: pandoc-secref
- include: pandoc-eqref
- include: pandoc-tblref
- include: pandoc-tbllabel
- include: pandoc-eqlabel
- include: pandoc-seclabel
- include: pandoc-citation

- include: escape
- include: ampersand
- include: bracket
Expand Down