Skip to content

Commit

Permalink
Merge branch 'st3-develop' into st4-develop
Browse files Browse the repository at this point in the history
  • Loading branch information
deathaxe committed Jul 25, 2024
2 parents 933e114 + 00af35d commit bf0168b
Show file tree
Hide file tree
Showing 6 changed files with 206 additions and 5 deletions.
21 changes: 21 additions & 0 deletions Default (Linux).sublime-keymap
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,27 @@
]
},

//
// Auto-Pairing Highlight
//

{ "keys": ["="], "command": "insert_snippet", "args": {"contents": "==${0:$SELECTION}=="}, "context":
[
{ "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw - markup.kbd", "match_all": true },
{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": false, "match_all": true }
]
},
{ "keys": ["backspace"], "command": "run_macro_file", "args": {"file": "Packages/MarkdownEditing/macros/Delete Left Right 2.sublime-macro"}, "context":
[
{ "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw - markup.kbd", "match_all": true },
{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
{ "key": "preceding_text", "operator": "regex_contains", "operand": "==$", "match_all": true },
{ "key": "following_text", "operator": "regex_contains", "operand": "^==", "match_all": true }
]
},

//
// Auto-Pairing Strike Through
//
Expand Down
21 changes: 21 additions & 0 deletions Default (OSX).sublime-keymap
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,27 @@
]
},

//
// Auto-Pairing Highlight
//

{ "keys": ["="], "command": "insert_snippet", "args": {"contents": "==${0:$SELECTION}=="}, "context":
[
{ "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw - markup.kbd", "match_all": true },
{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": false, "match_all": true }
]
},
{ "keys": ["backspace"], "command": "run_macro_file", "args": {"file": "Packages/MarkdownEditing/macros/Delete Left Right 2.sublime-macro"}, "context":
[
{ "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw - markup.kbd", "match_all": true },
{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
{ "key": "preceding_text", "operator": "regex_contains", "operand": "==$", "match_all": true },
{ "key": "following_text", "operator": "regex_contains", "operand": "^==", "match_all": true }
]
},

//
// Auto-Pairing Strike Through
//
Expand Down
21 changes: 21 additions & 0 deletions Default (Windows).sublime-keymap
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,27 @@
]
},

//
// Auto-Pairing Highlight
//

{ "keys": ["="], "command": "insert_snippet", "args": {"contents": "==${0:$SELECTION}=="}, "context":
[
{ "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw - markup.kbd", "match_all": true },
{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": false, "match_all": true }
]
},
{ "keys": ["backspace"], "command": "run_macro_file", "args": {"file": "Packages/MarkdownEditing/macros/Delete Left Right 2.sublime-macro"}, "context":
[
{ "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw - markup.kbd", "match_all": true },
{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
{ "key": "preceding_text", "operator": "regex_contains", "operand": "==$", "match_all": true },
{ "key": "following_text", "operator": "regex_contains", "operand": "^==", "match_all": true }
]
},

//
// Auto-Pairing Strike Through
//
Expand Down
1 change: 1 addition & 0 deletions messages/next.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ feedback you can use [GitHub issues][issues].

## New Features

* syntax highlighting for `==highlight==` emphasis (#764)
* syntax highlighting for Groovy in fenced code blocks (#768)

## Changes
Expand Down
25 changes: 23 additions & 2 deletions syntaxes/Markdown.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -3244,6 +3244,7 @@ contexts:
emphasis:
- include: bold
- include: italic
- include: highlight
- include: strikethrough

images:
Expand Down Expand Up @@ -3378,6 +3379,7 @@ contexts:
scope: markup.italic.markdown punctuation.definition.italic.end.markdown
set: bold-after-bold-italic-asterisk
- include: emphasis-common
- include: highlight
- include: strikethrough

bold-after-bold-italic-asterisk:
Expand Down Expand Up @@ -3424,6 +3426,7 @@ contexts:
scope: markup.italic.markdown punctuation.definition.bold.end.markdown
set: italic-after-bold-italic-underscore
- include: emphasis-common
- include: highlight
- include: strikethrough

bold-after-bold-italic-underscore:
Expand Down Expand Up @@ -3453,6 +3456,7 @@ contexts:
bold-common:
- include: emphasis-common
- include: italic
- include: highlight
- include: strikethrough

italic:
Expand Down Expand Up @@ -3492,8 +3496,25 @@ contexts:
italic-common:
- include: emphasis-common
- include: bold
- include: highlight
- include: strikethrough

highlight:
- match: ==(?![=>\s]) # 2x = but no =>
scope: punctuation.definition.highlight.begin.markdown
push: highlight-content
- match: =+(?![=>\s]) # any number of = not looking like =>

highlight-content:
- meta_scope: markup.highlight.markdown
- match: ==(?!=) # 2x =
scope: punctuation.definition.highlight.end.markdown
pop: 1
- match: '[ \t]*=+'
- include: emphasis-common
- include: bold
- include: italic

strikethrough:
# https://github.github.com/gfm/#strikethrough-extension-
- match: ~~(?![~}>\s]) # 2x ~ but no ~> or ~~}
Expand All @@ -3506,7 +3527,7 @@ contexts:
- match: ~~(?:(?!~)|(?=~~}|~>)) # 2x ~ maybe followed by ~> or ~~}
scope: punctuation.definition.strikethrough.end.markdown
pop: 1
- match: ~+(?:(?!~)|(?=~~}|~>)) # any number of ~ maybe followed by ~> or ~~}
- match: '[ \t]*~+(?:(?!~)|(?=~~}|~>))' # any number of ~ maybe followed by ~> or ~~}
- include: emphasis-common
- include: bold
- include: italic
Expand Down Expand Up @@ -3995,7 +4016,7 @@ contexts:
- meta_scope: meta.link.inet.markdown markup.underline.link.markdown-gfm
# 1. When an autolink ends in ), we scan the entire autolink for the total
# number of parentheses. If there is a greater number of closing parentheses
# than opening ones, we dont consider the last character part of the
# than opening ones, we don’t consider the last character part of the
# autolink, in order to facilitate including an autolink inside a parenthesis
# 2. If an autolink ends in a semicolon (;), we check to see if it appears to
# resemble an entity reference; if the preceding text is & followed by one
Expand Down
122 changes: 119 additions & 3 deletions tests/syntax_test_markdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -7269,6 +7269,117 @@ __test <span>text__ *formatted</span>*
| ^ punctuation
| ^ punctuation
# TEST: HIGHLIGHT #############################################################
__==bold highlight==__
| <- markup.bold.markdown punctuation.definition.bold.begin.markdown
|^ markup.bold.markdown - markup.highlight
| ^^^^^^^^^^^^^^^^^^ markup.bold.markdown markup.highlight.markdown
| ^^ markup.bold.markdown - markup.highlight
|^ punctuation.definition.bold.begin.markdown
| ^^ punctuation.definition.highlight.begin.markdown
| ^^ punctuation.definition.highlight.end.markdown
| ^^ punctuation.definition.bold.end.markdown
**==bold highlight==**
| <- markup.bold.markdown punctuation.definition.bold.begin.markdown
|^ markup.bold.markdown - markup.highlight
| ^^^^^^^^^^^^^^^^^^ markup.bold.markdown markup.highlight.markdown
| ^^ markup.bold.markdown - markup.highlight
|^ punctuation.definition.bold.begin.markdown
| ^^ punctuation.definition.highlight.begin.markdown
| ^^ punctuation.definition.highlight.end.markdown
| ^^ punctuation.definition.bold.end.markdown
_==italic highlight==_
| <- markup.italic.markdown punctuation.definition.italic.begin.markdown
|^^^^^^^^^^^^^^^^^^^^ markup.italic.markdown markup.highlight.markdown
| ^ markup.italic.markdown - markup.highlight
|^^ punctuation.definition.highlight.begin.markdown
| ^^ punctuation.definition.highlight.end.markdown
| ^ punctuation.definition.italic.end.markdown
*==italic highlight==*
| <- markup.italic.markdown punctuation.definition.italic.begin.markdown
|^^^^^^^^^^^^^^^^^^^^ markup.italic.markdown markup.highlight.markdown
| ^ markup.italic.markdown - markup.highlight
|^^ punctuation.definition.highlight.begin.markdown
| ^^ punctuation.definition.highlight.end.markdown
| ^ punctuation.definition.italic.end.markdown
___==bold italic highlight==___
| <- markup.bold.markdown punctuation.definition.bold.begin.markdown
|^ markup.bold.markdown - markup.italic - markup.highlight
| ^ markup.bold.markdown markup.italic.markdown - markup.highlight
| ^^^^^^^^^^^^^^^^^^^^^^^^^ markup.bold.markdown markup.italic.markdown markup.highlight.markdown
| ^ markup.bold.markdown markup.italic.markdown - markup.highlight
| ^^ markup.bold.markdown - markup.italic - markup.highlight
|^ punctuation.definition.bold.begin.markdown
| ^ punctuation.definition.italic.begin.markdown
| ^^ punctuation.definition.highlight.begin.markdown
| ^^ punctuation.definition.highlight.end.markdown
| ^ punctuation.definition.italic.end.markdown
| ^^ punctuation.definition.bold.end.markdown
***==bold italic highlight==***
| <- markup.bold.markdown punctuation.definition.bold.begin.markdown
|^ markup.bold.markdown - markup.italic - markup.highlight
| ^ markup.bold.markdown markup.italic.markdown - markup.highlight
| ^^^^^^^^^^^^^^^^^^^^^^^^^ markup.bold.markdown markup.italic.markdown markup.highlight.markdown
| ^ markup.bold.markdown markup.italic.markdown - markup.highlight
| ^^ markup.bold.markdown - markup.italic - markup.highlight
|^ punctuation.definition.bold.begin.markdown
| ^ punctuation.definition.italic.begin.markdown
| ^^ punctuation.definition.highlight.begin.markdown
| ^^ punctuation.definition.highlight.end.markdown
| ^ punctuation.definition.italic.end.markdown
| ^^ punctuation.definition.bold.end.markdown
=Hi= Hello, world!
| <- - punctuation.definition.highlight
|^^^^^^^^^^^^^^^^^ meta.paragraph - markup
| ^ - punctuation.definition.highlight
This =text==== is ====curious=.
|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.paragraph - markup
| ^ - punctuation.definition.highlight
| ^^^^ - punctuation.definition.highlight
| ^^^^ - punctuation.definition.highlight
| ^ - punctuation.definition.highlight
This ==text==== is ====curious==.
|^^^^ meta.paragraph - markup
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.paragraph markup.highlight
| ^^ meta.paragraph - markup
| ^^ punctuation.definition.highlight.begin
| ^^^^ - punctuation.definition.highlight
| ^^^^ - punctuation.definition.highlight
| ^^ punctuation.definition.highlight.end
This ==is ==highlighted== inline text
|^^^^ - markup.highlight
| ^^^^^^^^^^^^^^^^^^^^ markup.highlight.markdown
| ^^^^^^^^^^^^ - markup.highlight
This ==has a
| ^^^^^^^^ meta.paragraph markup.highlight
| <- meta.paragraph markup.highlight invalid.illegal.non-terminated.bold-italic
new paragraph==.
| ^^ meta.paragraph markup.highlight punctuation.definition.highlight.begin
| <- invalid.illegal.non-terminated.bold-italic
A ==[highlight](https://link-url)==
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.paragraph.markdown markup.highlight.markdown
A ==![highlight](https://image-url)==
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.paragraph.markdown markup.highlight.markdown
A ==[![highlight](image-url)](link-url)==
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.paragraph.markdown markup.highlight.markdown
# TEST: STRIKETHROUGH #########################################################
__~~bold striked~~__
Expand Down Expand Up @@ -7356,6 +7467,11 @@ This ~~text~~~~ is ~~~~curious~~.
| ^^^^ - punctuation.definition.strikethrough
| ^^ punctuation.definition.strikethrough.end
This ~~is ~~striked~~ inline text
|^^^^ - markup.strikethrough
| ^^^^^^^^^^^^^^^^ markup.strikethrough.markdown-gfm
| ^^^^^^^^^^^^^ - markup.strikethrough
This ~~has a
| ^^^^^^^^ meta.paragraph markup.strikethrough
Expand All @@ -7365,13 +7481,13 @@ new paragraph~~.
| <- invalid.illegal.non-terminated.bold-italic
A ~~[striked](https://link-url)~~
A ~~[highlight](https://link-url)~~
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.paragraph.markdown markup.strikethrough.markdown-gfm
A ~~![striked](https://image-url)~~
A ~~![highlight](https://image-url)~~
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.paragraph.markdown markup.strikethrough.markdown-gfm
A ~~[![striked](image-url)](link-url)~~
A ~~[![highlight](image-url)](link-url)~~
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.paragraph.markdown markup.strikethrough.markdown-gfm
Expand Down

0 comments on commit bf0168b

Please sign in to comment.