Skip to content

Commit 928f3e2

Browse files
committed
Merge branch 'st3-develop' into st4-develop
2 parents a6b3195 + 172bb31 commit 928f3e2

2 files changed

Lines changed: 174 additions & 26 deletions

File tree

syntaxes/Markdown.sublime-syntax

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -50,55 +50,58 @@ variables:
5050
5151
backticks: |-
5252
(?x:
53-
(`{4})(?![\s`])(?:[^`]+(?=`)|(?!`{4})`+(?!`))+(`{4})(?!`) # 4 backticks, followed by at least one non whitespace, non backtick character, followed by (less than 4 backticks, or at least one non backtick character) at least once, followed by exactly 4 backticks
54-
| (`{3})(?![\s`])(?:[^`]+(?=`)|(?!`{3})`+(?!`))+(`{3})(?!`) # 3 backticks, followed by at least one non whitespace, non backtick character, followed by (less than 3 backticks, or at least one non backtick character) at least once, followed by exactly 3 backticks
55-
| (`{2})(?![\s`])(?:[^`]+(?=`)|(?!`{2})`+(?!`))+(`{2})(?!`) # 2 backticks, followed by at least one non whitespace, non backtick character, followed by (less than 2 backticks, or at least one non backtick character) at least once, followed by exactly 2 backticks
56-
| (`{1})(?![\s`])(?:[^`]+(?=`)|(?!`{1})`+(?!`))+(`{1})(?!`) # 1 backtick, followed by at least one non whitespace, non backtick character, followed by ( at least one non backtick character) at least once, followed by exactly 1 backtick
53+
(`{4})[^`](?:[^`]|(?!`{4})`+[^`])*(`{4})(?!`) # 4 backticks, followed by at least one non backtick character, followed by (less than 4 backticks, or at least one non backtick character) at least once, followed by exactly 4 backticks
54+
| (`{3})[^`](?:[^`]|(?!`{3})`+[^`])*(`{3})(?!`) # 3 backticks, followed by at least one non backtick character, followed by (less than 3 backticks, or at least one non backtick character) at least once, followed by exactly 3 backticks
55+
| (`{2})[^`](?:[^`]|(?!`{2})`+[^`])*(`{2})(?!`) # 2 backticks, followed by at least one non backtick character, followed by (less than 2 backticks, or at least one non backtick character) at least once, followed by exactly 2 backticks
56+
| (`{1})[^`](?:[^`]|(?!`{1})`+[^`])*(`{1})(?!`) # 1 backtick, followed by at least one non backtick character, followed by ( at least one non backtick character) at least once, followed by exactly 1 backtick
5757
)
5858
escapes: \\[-+*/!"#$%&'(),.:;<=>?@\[\\\]^_`{|}~]
5959

6060
balance_square_brackets: |-
6161
(?x:
6262
(?:
63-
(?:{{escapes}})+ # escape characters
64-
| [^\[\]`\\]+(?=[\[\]`\\]|$) # anything that isn't a square bracket or a backtick or the start of an escape character
63+
\\. # maybe escaped character (be lazy)
64+
| [^\[\]`] # anything that isn't a square bracket or backtick
6565
| {{backticks}} # inline code
66-
| \[(?: # nested square brackets (one level deep)
67-
[^\[\]`]+(?=[\[\]`]) # anything that isn't a square bracket or a backtick
68-
{{backticks}}? # balanced backticks
69-
)*\] # closing square bracket
66+
| \[ (?: # nested square brackets (one level deep)
67+
\\. # maybe escaped character (be lazy)
68+
| [^\[\]`] # anything that isn't a square bracket or backtick
69+
| {{backticks}} # inline code
70+
)* \] # closing square bracket
7071
)+
7172
)
7273
balance_square_brackets_and_emphasis: |-
7374
(?x:
7475
(?:
75-
(?:{{escapes}})+ # escape characters
76-
| [^\[\]`\\_*]+(?=[\[\]`\\_*]|$) # anything that isn't a square bracket, a backtick, the start of an escape character, or an emphasis character
76+
\\. # maybe escaped character (be lazy)
77+
| [^\[\]`_*] # anything that isn't a square bracket, backtick or emphasis
7778
| {{backticks}} # inline code
78-
| \[(?: # nested square brackets (one level deep)
79-
[^\[\]`]+(?=[\[\]`]) # anything that isn't a square bracket or a backtick
80-
{{backticks}}? # balanced backticks
81-
)*\] # closing square bracket
79+
| \[ (?: # nested square brackets (one level deep)
80+
\\. # maybe escaped character (be lazy)
81+
| [^\[\]`_*] # anything that isn't a square bracket, backtick or emphasis
82+
| {{backticks}} # inline code
83+
)* \] # closing square bracket
8284
)+ # at least one character
8385
)
8486
balance_square_brackets_pipes_and_emphasis: |-
8587
(?x:
8688
(?:
87-
(?:{{escapes}})+ # escape characters
88-
| [^\[\]`\\_*|]+(?=[\[\]`\\_*|]|$) # anything that isn't a square bracket, a backtick, the start of an escape character, or an emphasis character
89+
\\. # maybe escaped character (be lazy)
90+
| [^\[\]`_*|] # anything that isn't a square bracket, backtick or emphasis or table cell separator
8991
| {{backticks}} # inline code
90-
| \[(?: # nested square brackets (one level deep)
91-
[^\[\]`]+(?=[\[\]`]) # anything that isn't a square bracket or a backtick
92-
{{backticks}}? # balanced backticks
93-
)*\] # closing square bracket
92+
| \[ (?: # nested square brackets (one level deep)
93+
\\. # maybe escaped character (be lazy)
94+
| [^\[\]`_*|] # anything that isn't a square bracket, backtick or emphasis or table cell separator
95+
| {{backticks}} # inline code
96+
)* \] # closing square bracket
9497
)+ # at least one character
9598
)
9699
balanced_emphasis: |-
97100
(?x:
98-
\* (?!\*){{balance_square_brackets_and_emphasis}}+\* (?!\*)
99-
| \*\* {{balance_square_brackets_and_emphasis}}+\*\*
100-
| _ (?!_) {{balance_square_brackets_and_emphasis}}+_ (?!_)
101-
| __ {{balance_square_brackets_and_emphasis}}+__
101+
\* (?!\*){{balance_square_brackets_and_emphasis}}\* (?!\*)
102+
| \*\* {{balance_square_brackets_and_emphasis}}\*\*
103+
| _ (?!_) {{balance_square_brackets_and_emphasis}}_ (?!_)
104+
| __ {{balance_square_brackets_and_emphasis}}__
102105
)
103106
104107
table_cell: |-

tests/syntax_test_markdown.md

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6047,6 +6047,25 @@ blah*
60476047
| ^ punctuation.definition.string.begin.markdown
60486048
| ^ punctuation.definition.string.end.markdown
60496049
| ^ punctuation.definition.metadata.end.markdown
6050+
6051+
Complex ![image $\ce{H2O}$.](./img/image6.png){#fig:image6 height=12.09cm }
6052+
| ^^^^^^^^^^^^^^^^^^^^ meta.image.inline.description.markdown
6053+
| ^^ punctuation.definition.image.begin.markdown
6054+
| ^^^^^^^^^^ markup.math.inline.markdown text.tex.latex.embedded.markdown meta.environment.math.block.dollar.latex
6055+
| ^ punctuation.definition.image.end.markdown
6056+
| ^^^^^^^^^^^^^^^^^^ meta.image.inline.metadata.markdown
6057+
| ^ punctuation.definition.metadata.begin.markdown
6058+
| ^^^^^^^^^^^^^^^^ markup.underline.link.image.markdown
6059+
| ^ punctuation.definition.metadata.end.markdown
6060+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.image.inline.attributes.markdown
6061+
| ^ punctuation.definition.attributes.begin.markdown
6062+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute-with-value.markdown
6063+
| ^^^^^^^^^^^ entity.other.attribute-name.markdown
6064+
| ^^^^^^ entity.other.attribute-name.markdown
6065+
| ^ punctuation.separator.key-value.markdown
6066+
| ^^^^^^^ string.unquoted.markdown
6067+
| ^ punctuation.definition.attributes.end.markdown
6068+
60506069

60516070

60526071
# TEST: CODE SPANS ############################################################
@@ -7379,6 +7398,27 @@ A ==![highlight](https://image-url)==
73797398
A ==[![highlight](image-url)](link-url)==
73807399
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.paragraph.markdown markup.highlight.markdown
73817400
7401+
A ==![image $\ce{H2O}$.](./img/image6.png){#fig:image6 height=12.09cm }==
7402+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.highlight.markdown
7403+
| ^^ punctuation.definition.highlight.begin.markdown
7404+
| ^^^^^^^^^^^^^^^^^^^^ meta.image.inline.description.markdown
7405+
| ^^ punctuation.definition.image.begin.markdown
7406+
| ^^^^^^^^^^ markup.math.inline.markdown text.tex.latex.embedded.markdown meta.environment.math.block.dollar.latex
7407+
| ^ punctuation.definition.image.end.markdown
7408+
| ^^^^^^^^^^^^^^^^^^ meta.image.inline.metadata.markdown
7409+
| ^ punctuation.definition.metadata.begin.markdown
7410+
| ^^^^^^^^^^^^^^^^ markup.underline.link.image.markdown
7411+
| ^ punctuation.definition.metadata.end.markdown
7412+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.image.inline.attributes.markdown
7413+
| ^ punctuation.definition.attributes.begin.markdown
7414+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute-with-value.markdown
7415+
| ^^^^^^^^^^^ entity.other.attribute-name.markdown
7416+
| ^^^^^^ entity.other.attribute-name.markdown
7417+
| ^ punctuation.separator.key-value.markdown
7418+
| ^^^^^^^ string.unquoted.markdown
7419+
| ^ punctuation.definition.attributes.end.markdown
7420+
| ^^ punctuation.definition.highlight.end.markdown
7421+
73827422
73837423
# TEST: STRIKETHROUGH #########################################################
73847424
@@ -7490,6 +7530,27 @@ A ~~![highlight](https://image-url)~~
74907530
A ~~[![highlight](image-url)](link-url)~~
74917531
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.paragraph.markdown markup.strikethrough.markdown-gfm
74927532
7533+
A ~~![image $\ce{H2O}$.](./img/image6.png){#fig:image6 height=12.09cm }~~
7534+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.strikethrough.markdown-gfm
7535+
| ^^ punctuation.definition.strikethrough.begin.markdown
7536+
| ^^^^^^^^^^^^^^^^^^^^ meta.image.inline.description.markdown
7537+
| ^^ punctuation.definition.image.begin.markdown
7538+
| ^^^^^^^^^^ markup.math.inline.markdown text.tex.latex.embedded.markdown meta.environment.math.block.dollar.latex
7539+
| ^ punctuation.definition.image.end.markdown
7540+
| ^^^^^^^^^^^^^^^^^^ meta.image.inline.metadata.markdown
7541+
| ^ punctuation.definition.metadata.begin.markdown
7542+
| ^^^^^^^^^^^^^^^^ markup.underline.link.image.markdown
7543+
| ^ punctuation.definition.metadata.end.markdown
7544+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.image.inline.attributes.markdown
7545+
| ^ punctuation.definition.attributes.begin.markdown
7546+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute-with-value.markdown
7547+
| ^^^^^^^^^^^ entity.other.attribute-name.markdown
7548+
| ^^^^^^ entity.other.attribute-name.markdown
7549+
| ^ punctuation.separator.key-value.markdown
7550+
| ^^^^^^^ string.unquoted.markdown
7551+
| ^ punctuation.definition.attributes.end.markdown
7552+
| ^^ punctuation.definition.strikethrough.end.markdown
7553+
74937554
74947555
# TEST: LINKS #################################################################
74957556
@@ -7870,6 +7931,90 @@ Here is a ![Image Ref Alt][1].
78707931
| ^ markup.underline.link.markdown
78717932
| ^ punctuation.definition.metadata.end.markdown
78727933
7934+
A complex ![image $\ce{H2O}$.](./img/image6.png){#fig:image6 height=12.09cm }
7935+
| ^^^^^^^^^^^^^^^^^^^^ meta.image.inline.description.markdown
7936+
| ^^ punctuation.definition.image.begin.markdown
7937+
| ^^^^^^^^^^ markup.math.inline.markdown text.tex.latex.embedded.markdown meta.environment.math.block.dollar.latex
7938+
| ^ punctuation.definition.image.end.markdown
7939+
| ^^^^^^^^^^^^^^^^^^ meta.image.inline.metadata.markdown
7940+
| ^ punctuation.definition.metadata.begin.markdown
7941+
| ^^^^^^^^^^^^^^^^ markup.underline.link.image.markdown
7942+
| ^ punctuation.definition.metadata.end.markdown
7943+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.image.inline.attributes.markdown
7944+
| ^ punctuation.definition.attributes.begin.markdown
7945+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute-with-value.markdown
7946+
| ^^^^^^^^^^^ entity.other.attribute-name.markdown
7947+
| ^^^^^^ entity.other.attribute-name.markdown
7948+
| ^ punctuation.separator.key-value.markdown
7949+
| ^^^^^^^ string.unquoted.markdown
7950+
| ^ punctuation.definition.attributes.end.markdown
7951+
7952+
With codepsan ![`a`b]()
7953+
| ^^^^^^^ meta.image.inline.description.markdown
7954+
| ^^ punctuation.definition.image.begin.markdown
7955+
| ^^^ markup.raw.inline.markdown
7956+
| ^ punctuation.definition.raw.begin.markdown
7957+
| ^ punctuation.definition.raw.end.markdown
7958+
| ^ punctuation.definition.image.end.markdown
7959+
| ^^ meta.image.inline.metadata.markdown
7960+
| ^ punctuation.definition.metadata.begin.markdown
7961+
| ^ punctuation.definition.metadata.end.markdown
7962+
7963+
With codepsan ![``a`b``]()
7964+
| ^^^^^^^^^^ meta.image.inline.description.markdown
7965+
| ^^ punctuation.definition.image.begin.markdown
7966+
| ^^^^^^^ markup.raw.inline.markdown
7967+
| ^^ punctuation.definition.raw.begin.markdown
7968+
| ^^ punctuation.definition.raw.end.markdown
7969+
| ^ punctuation.definition.image.end.markdown
7970+
| ^^ meta.image.inline.metadata.markdown
7971+
| ^ punctuation.definition.metadata.begin.markdown
7972+
| ^ punctuation.definition.metadata.end.markdown
7973+
7974+
With codepsan ![` `]()
7975+
| ^^^^^^ meta.image.inline.description.markdown
7976+
| ^^ punctuation.definition.image.begin.markdown
7977+
| ^^^ markup.raw.inline.markdown
7978+
| ^ punctuation.definition.raw.begin.markdown
7979+
| ^ punctuation.definition.raw.end.markdown
7980+
| ^ punctuation.definition.image.end.markdown
7981+
| ^^ meta.image.inline.metadata.markdown
7982+
| ^ punctuation.definition.metadata.begin.markdown
7983+
| ^ punctuation.definition.metadata.end.markdown
7984+
7985+
With codepsan ![`` ` ``]()
7986+
| ^^^^^^^^^^ meta.image.inline.description.markdown
7987+
| ^^ punctuation.definition.image.begin.markdown
7988+
| ^^^^^^^ markup.raw.inline.markdown
7989+
| ^^ punctuation.definition.raw.begin.markdown
7990+
| ^^ punctuation.definition.raw.end.markdown
7991+
| ^ punctuation.definition.image.end.markdown
7992+
| ^^ meta.image.inline.metadata.markdown
7993+
| ^ punctuation.definition.metadata.begin.markdown
7994+
| ^ punctuation.definition.metadata.end.markdown
7995+
7996+
With codepsan ![``` `` ```]()
7997+
| ^^^^^^^^^^^^^ meta.image.inline.description.markdown
7998+
| ^^ punctuation.definition.image.begin.markdown
7999+
| ^^^^^^^^^^ markup.raw.inline.markdown
8000+
| ^^^ punctuation.definition.raw.begin.markdown
8001+
| ^^^ punctuation.definition.raw.end.markdown
8002+
| ^ punctuation.definition.image.end.markdown
8003+
| ^^ meta.image.inline.metadata.markdown
8004+
| ^ punctuation.definition.metadata.begin.markdown
8005+
| ^ punctuation.definition.metadata.end.markdown
8006+
8007+
With codepsan ![```` ``` ````]()
8008+
| ^^^^^^^^^^^^^^^^ meta.image.inline.description.markdown
8009+
| ^^ punctuation.definition.image.begin.markdown
8010+
| ^^^^^^^^^^^^^ markup.raw.inline.markdown
8011+
| ^^^^ punctuation.definition.raw.begin.markdown
8012+
| ^^^^ punctuation.definition.raw.end.markdown
8013+
| ^ punctuation.definition.image.end.markdown
8014+
| ^^ meta.image.inline.metadata.markdown
8015+
| ^ punctuation.definition.metadata.begin.markdown
8016+
| ^ punctuation.definition.metadata.end.markdown
8017+
78738018
78748019
# TEST: FOOTNOTES #############################################################
78758020

0 commit comments

Comments
 (0)