From 2f59f2fa931ae5280955bc6e598196eb33b4d5e6 Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Mon, 20 Sep 2021 20:42:02 +0200 Subject: [PATCH 01/56] Syntax: Refactor tables contexts This commit... 1. adds named contexts 2. adds block-level bailout (table-end) to headier line in order to correctly escape if block-level structures are found --- syntaxes/Markdown.sublime-syntax | 107 ++++++++++++++++++------------- tests/syntax_test_markdown.md | 24 +++++++ 2 files changed, 85 insertions(+), 46 deletions(-) diff --git a/syntaxes/Markdown.sublime-syntax b/syntaxes/Markdown.sublime-syntax index ffbda393..be51304e 100644 --- a/syntaxes/Markdown.sublime-syntax +++ b/syntaxes/Markdown.sublime-syntax @@ -256,7 +256,7 @@ contexts: - include: indented-code-block - include: atx-heading - include: thematic-break - - include: table + - include: tables - include: immediately-pop - match: ^([ ]{0,3})([*+-])( (\[)([ xX])(\]))?(?=\s) captures: @@ -2684,53 +2684,68 @@ contexts: - include: link-url-path-separators - include: link-url-escapes -###[ TABLE ]################################################################## +###[ LEAF BLOCKS: TABLES ]#################################################### - table: + tables: - match: ^(?={{table_first_row}}) - push: - - meta_content_scope: meta.table.header.markdown-gfm - - match: \| - scope: punctuation.separator.table-cell.markdown - - include: inline-bold-italic - - match: $\n? - set: - - match: ^ - set: - - meta_content_scope: meta.table.header-separator.markdown-gfm - - match: \| - scope: punctuation.separator.table-cell.markdown - - match: ':' - scope: punctuation.definition.table-cell-alignment.markdown - - match: -+ - scope: punctuation.section.table-header.markdown - - match: $\n? - set: - - meta_content_scope: meta.table.markdown-gfm - - match: |- # The table is broken at the first empty line, or beginning of another block-level structure - (?x)^ - (?= {{block_quote}} - | {{indented_code_block}}(?!$) - | {{atx_heading}} - | {{thematic_break}} - | \s*$ - ) - pop: true - - match: \| - scope: punctuation.separator.table-cell.markdown - - match: (?={{balanced_emphasis}}) - push: - - include: bold - - include: italic - - include: immediately-pop - - match: |- - (?x) - (?!{{backticks}}) - `+ - scope: invalid.deprecated.unescaped-backticks.markdown - - include: inline - - include: tag-kbd - - include: scope:text.html.basic + push: table-header + + table-header: + - meta_content_scope: meta.table.header.markdown-gfm + - match: \n + set: table-header-separator + - include: table-cell-content + + table-header-separator: + - meta_content_scope: meta.table.header-separator.markdown-gfm + - match: \n + set: table-body + - match: -+ + scope: punctuation.section.table-header.markdown + - match: ':' + scope: punctuation.definition.table-cell-alignment.markdown + - include: table-cell-separators + - include: table-end + + table-body: + - meta_content_scope: meta.table.markdown-gfm + - include: table-end + - include: table-cell-content + + table-end: + # The table is broken at the first empty line, or beginning of another block-level structure + - match: |- + (?x)^ + (?= \s*$ + | {{atx_heading}} + | {{block_quote}} + | {{fenced_code_block_start}} + | {{indented_code_block}} + | {{thematic_break}} + ) + pop: true + + table-cell-content: + - match: (?={{balanced_emphasis}}) + push: table-cell-bold-italic + - match: |- + (?x) + (?!{{backticks}}) + `+ + scope: invalid.deprecated.unescaped-backticks.markdown + - include: table-cell-separators + - include: inline + - include: tag-kbd + - include: scope:text.html.basic + + table-cell-bold-italic: + - include: bold + - include: italic + - include: immediately-pop + + table-cell-separators: + - match: \| + scope: punctuation.separator.table-cell.markdown ###[ CRITIC MARKUP ]########################################################## diff --git a/tests/syntax_test_markdown.md b/tests/syntax_test_markdown.md index 23691d37..b00d2744 100644 --- a/tests/syntax_test_markdown.md +++ b/tests/syntax_test_markdown.md @@ -2488,6 +2488,30 @@ not a table | |^ invalid.deprecated.unescaped-backticks | ^ punctuation.separator.table-cell +| table | followed by +# heading +| <- markup.heading.1.markdown punctuation.definition.heading.begin.markdown +|^^^^^^^^^ markup.heading.1.markdown + +| table | followed by +> quote +| <- markup.quote.markdown punctuation.definition.blockquote.markdown +|^^^^^^^ markup.quote.markdown + +| table | followed by + quote +| <- markup.raw.block.markdown +|^^^^^^^^^ markup.raw.block.markdown + +| table | followed by +```fenced +| <- meta.code-fence.definition.begin.text.markdown-gfm +|^^^^^^^^^ meta.code-fence.definition.begin.text.markdown-gfm +code block +``` +| <- meta.code-fence.definition.end.text.markdown-gfm +|^^ meta.code-fence.definition.end.text.markdown-gfm + A line without bolded | | ^ - punctuation.separator.table-cell From 236b98197cc8d21ae30ab9842fc62fce86c272b3 Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Mon, 20 Sep 2021 21:33:39 +0200 Subject: [PATCH 02/56] Syntax: Reorganize disable-markdown contexts --- syntaxes/Markdown.sublime-syntax | 92 +++++++++++++++++++------------- 1 file changed, 55 insertions(+), 37 deletions(-) diff --git a/syntaxes/Markdown.sublime-syntax b/syntaxes/Markdown.sublime-syntax index be51304e..a1867620 100644 --- a/syntaxes/Markdown.sublime-syntax +++ b/syntaxes/Markdown.sublime-syntax @@ -281,26 +281,9 @@ contexts: - match: ^(?=\S) pop: true - include: list-paragraph - - match: '^[ ]{0,3}(?=<((?i:pre))\b)' - comment: Markdown formatting is disabled inside block-level tags. - push: [disabled-markdown-pop-at-eol, disable-markdown-pop-at-tag] - - match: '^[ ]{0,3}(?=<{{html_tag_block_end_at_close_tag}})' - comment: Markdown formatting is disabled inside block-level tags. - push: [disabled-markdown-pop-at-eol, disable-markdown-pop-after-tag] - - match: '^[ ]{0,3}(?=<\?)' - comment: Markdown formatting is disabled inside preprocessor instructions. - push: [disabled-markdown-pop-at-eol, disable-markdown-pop-at-php] - - match: '^[ ]{0,3}(?=) captures: 1: meta.tag.block.any.html punctuation.definition.tag.begin.html 2: meta.tag.block.any.html entity.name.tag.block.any.html 3: meta.tag.block.any.html punctuation.definition.tag.end.html pop: true - - include: disable-markdown + - include: html-content - disable-markdown-pop-after-tag: + html-block-pop-after-tag: - match: (?! pop: true - - include: disable-markdown + - include: html-content - disable-markdown-pop-after-html-doctype: - - match: (?! Date: Mon, 20 Sep 2021 21:40:57 +0200 Subject: [PATCH 03/56] Syntax: Reorganize code-spans --- syntaxes/Markdown.sublime-syntax | 37 ++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/syntaxes/Markdown.sublime-syntax b/syntaxes/Markdown.sublime-syntax index a1867620..dcf4adfd 100644 --- a/syntaxes/Markdown.sublime-syntax +++ b/syntaxes/Markdown.sublime-syntax @@ -705,7 +705,7 @@ contexts: - include: critic-inline - include: ligatures - include: bracket - - include: code-span + - include: code-spans - include: autolink-email - include: autolink-inet - include: image-inline @@ -2030,20 +2030,6 @@ contexts: 0: meta.code-fence.definition.end.xonsh.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown - code-span: - - match: (`+)(?!`) - scope: punctuation.definition.raw.begin.markdown - push: - - meta_scope: markup.raw.inline.markdown - - match: \1(?!`) - scope: punctuation.definition.raw.end.markdown - pop: true - - match: '`+' - - match: ^\s*$\n? - scope: invalid.illegal.non-terminated.raw.markdown - pop: true - - include: paragraph-end - thematic-break: - match: (?={{thematic_break}}) push: @@ -2214,6 +2200,25 @@ contexts: pop: true - include: link-url-common +###[ INLINE: CODE SPANS ]##################################################### + + code-spans: + # https://spec.commonmark.org/0.30/#code-spans + - match: (`+)(?!`) + scope: punctuation.definition.raw.begin.markdown + push: code-span-body + + code-span-body: + - meta_scope: markup.raw.inline.markdown + - match: \1(?!`) + scope: punctuation.definition.raw.end.markdown + pop: true + - match: '`+' + - match: ^\s*$\n? + scope: invalid.illegal.non-terminated.raw.markdown + pop: true + - include: paragraph-end + ###[ INLINE IMAGES ]########################################################## image-inline: @@ -2472,7 +2477,7 @@ contexts: - match: \b\*\*?(?=[^]*]+\]) # eat asterisks where there is no pair before the end of the square brackets - it's not a formatting mark - include: escape - include: ampersand - - include: code-span + - include: code-spans - match: \[ # nested square brackets are allowed push: - include: link-text From ed85a46ca5c61fb31ab22e05cedafefaa9ecfbba Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Mon, 20 Sep 2021 21:44:54 +0200 Subject: [PATCH 04/56] Syntax: Reorganize thematic breaks --- syntaxes/Markdown.sublime-syntax | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/syntaxes/Markdown.sublime-syntax b/syntaxes/Markdown.sublime-syntax index dcf4adfd..ccda8bab 100644 --- a/syntaxes/Markdown.sublime-syntax +++ b/syntaxes/Markdown.sublime-syntax @@ -255,7 +255,7 @@ contexts: - include: ligatures - include: indented-code-block - include: atx-heading - - include: thematic-break + - include: thematic-breaks - include: tables - include: immediately-pop - match: ^([ ]{0,3})([*+-])( (\[)([ xX])(\]))?(?=\s) @@ -394,7 +394,7 @@ contexts: - include: block-quote-list-item - include: atx-heading - include: indented-code-block - - include: thematic-break + - include: thematic-breaks - match: '' set: block-quote-text @@ -850,7 +850,7 @@ contexts: - include: fenced-code-blocks - match: ^ pop: true - - include: thematic-break + - include: thematic-breaks - match: (?=\S)(?!{{list_item}}) push: - match: (?={{list_item}}) @@ -2030,15 +2030,6 @@ contexts: 0: meta.code-fence.definition.end.xonsh.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown - thematic-break: - - match: (?={{thematic_break}}) - push: - - meta_scope: meta.separator.thematic-break.markdown - - match: '[-_*]+' - scope: punctuation.definition.thematic-break.markdown - - match: '$\n?' - pop: true - ###[ LEAF BLOCKS: HTML BLOCKS ]############################################### html-blocks: @@ -2200,6 +2191,20 @@ contexts: pop: true - include: link-url-common +###[ LEAF BLOCKS: THEMATIC BREAKS ]########################################### + + thematic-breaks: + # https://spec.commonmark.org/0.30/#thematic-breaks + - match: (?={{thematic_break}}) + push: thematic-break-body + + thematic-break-body: + - meta_scope: meta.separator.thematic-break.markdown + - match: '[-_*]+' + scope: punctuation.definition.thematic-break.markdown + - match: \n + pop: true + ###[ INLINE: CODE SPANS ]##################################################### code-spans: From 48375d32ffdfa6b77b9048df9808867e4aa2adfe Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Mon, 20 Sep 2021 21:55:27 +0200 Subject: [PATCH 05/56] Syntax: Add fenced codeblock section header --- syntaxes/Markdown.sublime-syntax | 3 +++ 1 file changed, 3 insertions(+) diff --git a/syntaxes/Markdown.sublime-syntax b/syntaxes/Markdown.sublime-syntax index ccda8bab..346e984a 100644 --- a/syntaxes/Markdown.sublime-syntax +++ b/syntaxes/Markdown.sublime-syntax @@ -861,7 +861,10 @@ contexts: - match: $ pop: true +###[ LEAF BLOCKS: FENCED CODE BLOCKS ]######################################## + fenced-code-blocks: + # https://spec.commonmark.org/0.30/#fenced-code-blocks - match: ^(?={{fenced_code_block_start}}) push: fenced-code-block-content From 1c3d37d13c67aea9ea81852dfa71caebbd095c34 Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Mon, 20 Sep 2021 21:57:42 +0200 Subject: [PATCH 06/56] Syntax: Reorganize indented code block contexts --- syntaxes/Markdown.sublime-syntax | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/syntaxes/Markdown.sublime-syntax b/syntaxes/Markdown.sublime-syntax index 346e984a..a6fa9293 100644 --- a/syntaxes/Markdown.sublime-syntax +++ b/syntaxes/Markdown.sublime-syntax @@ -475,10 +475,6 @@ contexts: - include: tag-kbd - include: scope:text.html.basic - indented-code-block: - - match: '{{indented_code_block}}.*$\n?' - scope: markup.raw.block.markdown - bold: - include: ligatures - match: '(\*\*)(\*)(?=\S)(?!\*)' @@ -861,6 +857,13 @@ contexts: - match: $ pop: true +###[ LEAF BLOCKS: INDENTED CODE BLOCKS ]###################################### + + indented-code-block: + # https://spec.commonmark.org/0.30/#indented-code-blocks + - match: '{{indented_code_block}}.*$\n?' + scope: markup.raw.block.markdown + ###[ LEAF BLOCKS: FENCED CODE BLOCKS ]######################################## fenced-code-blocks: From 59c11ec070ca8015fca7a5f26b54ec3d1a4daf5c Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Mon, 20 Sep 2021 22:02:59 +0200 Subject: [PATCH 07/56] Syntax: Reorganize list blocks --- syntaxes/Markdown.sublime-syntax | 59 ++++++++++++++++++-------------- 1 file changed, 34 insertions(+), 25 deletions(-) diff --git a/syntaxes/Markdown.sublime-syntax b/syntaxes/Markdown.sublime-syntax index a6fa9293..248a2748 100644 --- a/syntaxes/Markdown.sublime-syntax +++ b/syntaxes/Markdown.sublime-syntax @@ -258,29 +258,7 @@ contexts: - include: thematic-breaks - include: tables - include: immediately-pop - - match: ^([ ]{0,3})([*+-])( (\[)([ xX])(\]))?(?=\s) - captures: - 1: markup.list.unnumbered.markdown - 2: markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown - 3: markup.list.unnumbered.markdown - 4: markup.checkbox.begin.markdown-gfm punctuation.definition.checkbox.begin.markdown-gfm - 5: markup.checkbox.mark.markdown-gfm - 6: markup.checkbox.end.markdown-gfm punctuation.definition.checkbox.end.markdown-gfm - push: - - meta_content_scope: markup.list.unnumbered.markdown - - match: ^(?=\S) - pop: true - - include: list-paragraph - - match: ^([ ]{0,3})(\d+([.)]))(?=\s) - captures: - 1: markup.list.numbered.markdown - 2: markup.list.numbered.bullet.markdown - 3: punctuation.definition.list_item.markdown - push: - - meta_content_scope: markup.list.numbered.markdown - - match: ^(?=\S) - pop: true - - include: list-paragraph + - include: list-blocks - include: reference-definitions - include: latex-blocks - include: html-blocks @@ -791,6 +769,37 @@ contexts: captures: 1: constant.character.escape.markdown +###[ CONTAINER BLOCKS: LISTS ]################################################ + + list-blocks: + - match: ^([ ]{0,3})([*+-])( (\[)([ xX])(\]))?(?=\s) + captures: + 1: markup.list.unnumbered.markdown + 2: markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown + 3: markup.list.unnumbered.markdown + 4: markup.checkbox.begin.markdown-gfm punctuation.definition.checkbox.begin.markdown-gfm + 5: markup.checkbox.mark.markdown-gfm + 6: markup.checkbox.end.markdown-gfm punctuation.definition.checkbox.end.markdown-gfm + push: unordered-list-paragraph + - match: ^([ ]{0,3})(\d+([.)]))(?=\s) + captures: + 1: markup.list.numbered.markdown + 2: markup.list.numbered.bullet.markdown + 3: punctuation.definition.list_item.markdown + push: ordered-list-paragraph + + unordered-list-paragraph: + - meta_content_scope: markup.list.unnumbered.markdown + - match: ^(?=\S) + pop: true + - include: list-paragraph + + ordered-list-paragraph: + - meta_content_scope: markup.list.numbered.markdown + - match: ^(?=\S) + pop: true + - include: list-paragraph + list-paragraph: - match: '^(?=(?:[ ]{4}|\t){2,}(?![>+*\s-]))(?={{indented_code_block}})' push: @@ -835,9 +844,9 @@ contexts: scope: meta.paragraph.list.markdown - match: (?=^{{atx_heading}}) pop: true - - match: '(?=\S)' + - match: (?=\S) push: list-content - - match: '(?=\S)' + - match: (?=\S) pop: true list-content: From 9fb7e2974fc196ce7d8f94fd145e26df957d3e65 Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Tue, 21 Sep 2021 18:14:34 +0200 Subject: [PATCH 08/56] Syntax: Remove meta.block-level scope It doesn't have any valuable meaning but complicates syntax. --- syntaxes/Markdown.sublime-syntax | 27 ++--- tests/syntax_test_latex.md | 4 +- tests/syntax_test_markdown.md | 174 +++++++++++++++---------------- 3 files changed, 95 insertions(+), 110 deletions(-) diff --git a/syntaxes/Markdown.sublime-syntax b/syntaxes/Markdown.sublime-syntax index 248a2748..4f4818f4 100644 --- a/syntaxes/Markdown.sublime-syntax +++ b/syntaxes/Markdown.sublime-syntax @@ -237,27 +237,12 @@ contexts: 1: punctuation.section.block.end.frontmatter.markdown markdown: - - match: |- - (?x)^ - (?= {{block_quote}} - | {{indented_code_block}}(?!$) - | {{atx_heading}} - | {{thematic_break}} - | {{table_first_row}} - ) - comment: | - We could also use an empty end match and set - applyEndPatternLast, but then we must be sure that the begin - pattern will only match stuff matched by the sub-patterns. - push: - - meta_scope: meta.block-level.markdown - - include: block-quotes - - include: ligatures - - include: indented-code-block - - include: atx-heading - - include: thematic-breaks - - include: tables - - include: immediately-pop + - include: indented-code-block + - include: block-quotes + - include: ligatures + - include: atx-heading + - include: thematic-breaks + - include: tables - include: list-blocks - include: reference-definitions - include: latex-blocks diff --git a/tests/syntax_test_latex.md b/tests/syntax_test_latex.md index a7c5024c..11b33b80 100644 --- a/tests/syntax_test_latex.md +++ b/tests/syntax_test_latex.md @@ -18,8 +18,8 @@ $$ |^ text.tex.latex meta.environment.math.block.dollar.latex string.other.math.latex punctuation.definition.string.end.latex $$ -| <- meta.block-level.markdown markup.raw.block.markdown -|^^^^^^ meta.block-level.markdown markup.raw.block.markdown +| <- markup.raw.block.markdown +|^^^^^^ markup.raw.block.markdown 1. Numbered List diff --git a/tests/syntax_test_markdown.md b/tests/syntax_test_markdown.md index b00d2744..618b1994 100644 --- a/tests/syntax_test_markdown.md +++ b/tests/syntax_test_markdown.md @@ -18,7 +18,7 @@ https://spec.commonmark.org/0.30/#example-71 ## Heading ## -|^^^^^^^^^^^^^^^ meta.block-level.markdown markup.heading.2.markdown +|^^^^^^^^^^^^^^^ markup.heading.2.markdown |^ - punctuation | ^^ punctuation.definition.heading.begin.markdown | ^^^^^^^^^ - punctuation @@ -43,7 +43,7 @@ https://spec.commonmark.org/0.30/#example-74 https://spec.commonmark.org/0.30/#example-75 # #heading# # | <- markup.heading.1.markdown punctuation.definition.heading.begin.markdown -|^^^^^^^^^^^^^ meta.block-level.markdown markup.heading.1.markdown +|^^^^^^^^^^^^^ markup.heading.1.markdown |^ - entity.name.section | ^^^^^^^^^ entity.name.section.markdown | ^^ - entity.name.section @@ -52,7 +52,7 @@ https://spec.commonmark.org/0.30/#example-75 https://spec.commonmark.org/0.30/#example-76 ## heading \## | <- markup.heading.2.markdown punctuation.definition.heading.begin.markdown -|^^^^^^^^^^^^^^ meta.block-level.markdown markup.heading.2.markdown +|^^^^^^^^^^^^^^ markup.heading.2.markdown |^^ - entity | ^^^^^^^^^^^ entity.name.section.markdown | ^^ constant.character.escape.markdown @@ -65,7 +65,7 @@ https://spec.commonmark.org/0.30/#example-79 # # | <- markup.heading.1.markdown punctuation.definition.heading.begin.markdown -|^^^ meta.block-level.markdown markup.heading.1.markdown - entity.name.section +|^^^ markup.heading.1.markdown - entity.name.section | ^ punctuation.definition.heading.end.markdown ## @@ -74,19 +74,19 @@ https://spec.commonmark.org/0.30/#example-79 ## ## | <- markup.heading.2.markdown punctuation.definition.heading.begin.markdown - entity.name.section -|^^^^^ meta.block-level.markdown markup.heading.2.markdown - entity.name.section +|^^^^^ markup.heading.2.markdown - entity.name.section |^ punctuation.definition.heading.begin.markdown | ^^ punctuation.definition.heading.end.markdown ### ### -| <- meta.block-level.markdown markup.heading.3.markdown - entity.name.sectionpunctuation.definition.heading.begin.markdown -|^^^^^^^ meta.block-level.markdown markup.heading.3.markdown - entity.name.section +| <- markup.heading.3.markdown - entity.name.sectionpunctuation.definition.heading.begin.markdown +|^^^^^^^ markup.heading.3.markdown - entity.name.section |^^ punctuation.definition.heading.begin.markdown | ^^^ punctuation.definition.heading.end.markdown # #### # | <- markup.heading.1.markdown punctuation.definition.heading.begin.markdown -|^^^^^^^^ meta.block-level.markdown markup.heading.1.markdown +|^^^^^^^^ markup.heading.1.markdown |^ - entity.name.section | ^^^^ entity.name.section.markdown | ^^ - entity.name.section @@ -94,7 +94,7 @@ https://spec.commonmark.org/0.30/#example-79 ## #### ## | <- markup.heading.2.markdown punctuation.definition.heading.begin.markdown -|^^^^^^^^^^ meta.block-level.markdown markup.heading.2.markdown +|^^^^^^^^^^ markup.heading.2.markdown |^ - entity.name.section | ^^^^ entity.name.section.markdown | ^^^ - entity.name.section @@ -145,7 +145,7 @@ heading underlined with dashes underlined heading followed by a separator ------------------- ------ -| <- meta.block-level meta.separator - markup.heading +| <- meta.separator - markup.heading underlined heading followed by another one that should be treated as a normal paragraph ================== @@ -462,13 +462,13 @@ Paragraph break. Paragraph break. --- -|^^^ meta.block-level meta.separator.thematic-break +|^^^ meta.separator.thematic-break |^^ punctuation.definition.thematic-break Paragraph break. -------- -|^^^^^^^^ meta.block-level meta.separator.thematic-break +|^^^^^^^^ meta.separator.thematic-break |^^^^^^^ punctuation.definition.thematic-break [1]: https://google.com @@ -554,41 +554,41 @@ non-disabled markdown | ^^ - punctuation.definition.blockquote.markdown > Block quote -| <- meta.block-level markup.quote punctuation.definition.blockquote -| ^^^^^^^^^^^ meta.block-level markup.quote +| <- markup.quote punctuation.definition.blockquote +| ^^^^^^^^^^^ markup.quote > Block quote followed by an empty block quote line > -| <- meta.block-level markup.quote punctuation.definition.blockquote +| <- markup.quote punctuation.definition.blockquote > Block quote followed by an empty block quote line > > Followed by more quoted text -| <- meta.block-level markup.quote punctuation.definition.blockquote +| <- markup.quote punctuation.definition.blockquote > > Nested block quote -| <- meta.block-level markup.quote punctuation.definition.blockquote -| ^^^^^^^^^^^^^^^^^^^^^ meta.block-level.markdown markup.quote.markdown markup.quote.markdown +| <- markup.quote punctuation.definition.blockquote +| ^^^^^^^^^^^^^^^^^^^^^ markup.quote.markdown markup.quote.markdown |^ - punctuation | ^ punctuation.definition.blockquote | ^ - punctuation > > Nested quote > Followed by more quoted text that is not nested -| <- meta.block-level markup.quote punctuation.definition.blockquote - markup.quote markup.quote +| <- markup.quote punctuation.definition.blockquote - markup.quote markup.quote > Here is a block quote This quote continues on. Line breaking is OK in markdown -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block-level markup.quote +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.quote > Here it is again | <- punctuation.definition.blockquote paragraph -| <- meta.paragraph - meta.block-level +| <- meta.paragraph > > this is a nested quote but no code in a block quote | <- punctuation.definition.blockquote -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block-level.markdown markup.quote.markdown markup.quote.markdown +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.quote.markdown markup.quote.markdown > > this is code in a block quote, not a nested quote | <- punctuation.definition.blockquote @@ -596,53 +596,53 @@ paragraph > CommonMark expects following line to be indented code block (see: example 326) > but all common parsers handle it as continued text. -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block-level.markdown markup.quote.markdown - markup.raw +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.quote.markdown - markup.raw | ^ - punctuation > Quoted fenced code block begin > ``` -| <- meta.block-level.markdown markup.quote.markdown punctuation.definition.blockquote.markdown -|^ meta.block-level.markdown markup.quote.markdown - meta.code-fence -| ^^^^ meta.block-level.markdown markup.quote.markdown meta.code-fence.definition.begin.text.markdown-gfm +| <- markup.quote.markdown punctuation.definition.blockquote.markdown +|^ markup.quote.markdown - meta.code-fence +| ^^^^ markup.quote.markdown meta.code-fence.definition.begin.text.markdown-gfm | ^^^ punctuation.definition.raw.code-fence.begin.markdown > Quoted fenced code block language identifier > ```C++ -| <- meta.block-level.markdown markup.quote.markdown punctuation.definition.blockquote.markdown -|^ meta.block-level.markdown markup.quote.markdown - meta.code-fence -| ^^^^^^^ meta.block-level.markdown markup.quote.markdown meta.code-fence.definition.begin.text.markdown-gfm +| <- markup.quote.markdown punctuation.definition.blockquote.markdown +|^ markup.quote.markdown - meta.code-fence +| ^^^^^^^ markup.quote.markdown meta.code-fence.definition.begin.text.markdown-gfm | ^^^ constant.other.language-name.markdown > Quoted fenced code block language identifier > ```C++ info string -| <- meta.block-level.markdown markup.quote.markdown punctuation.definition.blockquote.markdown -|^ meta.block-level.markdown markup.quote.markdown - meta.code-fence -| ^^^^^^^^^^^^^^^^^^^ meta.block-level.markdown markup.quote.markdown meta.code-fence.definition.begin.text.markdown-gfm +| <- markup.quote.markdown punctuation.definition.blockquote.markdown +|^ markup.quote.markdown - meta.code-fence +| ^^^^^^^^^^^^^^^^^^^ markup.quote.markdown meta.code-fence.definition.begin.text.markdown-gfm | ^^^ constant.other.language-name.markdown | ^^^^^^^^^^^^^ - constant > Quoted fenced code block content > ``` > code block -| <- meta.block-level.markdown markup.quote.markdown punctuation.definition.blockquote.markdown -|^ meta.block-level.markdown markup.quote.markdown - meta.code-fence -| ^^^^^^^^^^^ meta.block-level.markdown markup.quote.markdown markup.raw.code-fence.markdown-gfm +| <- markup.quote.markdown punctuation.definition.blockquote.markdown +|^ markup.quote.markdown - meta.code-fence +| ^^^^^^^^^^^ markup.quote.markdown markup.raw.code-fence.markdown-gfm > Quoted fenced code block end > ``` > ``` -| <- meta.block-level.markdown markup.quote.markdown punctuation.definition.blockquote.markdown -|^ meta.block-level.markdown markup.quote.markdown - meta.code-fence -| ^^^^ meta.block-level.markdown markup.quote.markdown meta.code-fence.definition.end.text.markdown-gfm +| <- markup.quote.markdown punctuation.definition.blockquote.markdown +|^ markup.quote.markdown - meta.code-fence +| ^^^^ markup.quote.markdown meta.code-fence.definition.end.text.markdown-gfm | ^^^ punctuation.definition.raw.code-fence.end.markdown > > 2nd level quoted fenced code block > > ``` > > code block ``` > > ``` -| <- meta.block-level.markdown markup.quote.markdown markup.quote.markdown punctuation.definition.blockquote.markdown -|^^^ meta.block-level.markdown markup.quote.markdown markup.quote.markdown - meta.code-fence -| ^^^^ meta.block-level.markdown markup.quote.markdown markup.quote.markdown meta.code-fence.definition.end.text.markdown-gfm +| <- markup.quote.markdown markup.quote.markdown punctuation.definition.blockquote.markdown +|^^^ markup.quote.markdown markup.quote.markdown - meta.code-fence +| ^^^^ markup.quote.markdown markup.quote.markdown meta.code-fence.definition.end.text.markdown-gfm > Block quote followed by fenced code block ``` @@ -672,8 +672,8 @@ no code block > Block quote followed by heading # heading -| <- meta.block-level.markdown markup.heading.1.markdown punctuation.definition.heading.begin.markdown -|^^^^^^^^^ meta.block-level.markdown markup.heading.1.markdown - meta.quote +| <- markup.heading.1.markdown punctuation.definition.heading.begin.markdown +|^^^^^^^^^ markup.heading.1.markdown - meta.quote | ^^^^^^^ entity.name.section.markdown > Block quote followed by list @@ -699,41 +699,41 @@ no code block > Block quote followed by thematic break *** -| <- meta.block-level.markdown meta.separator.thematic-break.markdown punctuation.definition.thematic-break.markdown - meta.quote +| <- meta.separator.thematic-break.markdown punctuation.definition.thematic-break.markdown - meta.quote > Block quote followed by thematic break - - - -| <- meta.block-level.markdown meta.separator.thematic-break.markdown punctuation.definition.thematic-break.markdown - meta.quote +| <- meta.separator.thematic-break.markdown punctuation.definition.thematic-break.markdown - meta.quote Code block below: this is code! -| ^^^^^^^^^^^^^^^^ meta.block-level markup.raw.block +| ^^^^^^^^^^^^^^^^ markup.raw.block more code spanning multiple lines -| ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block-level markup.raw.block +| ^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.raw.block paragraph -| <- meta.paragraph - meta.block-level +| <- meta.paragraph - - - - -| ^^^^^^ meta.block-level meta.separator +| ^^^^^^ meta.separator | ^ punctuation.definition.thematic-break | ^ punctuation.definition.thematic-break | ^ punctuation.definition.thematic-break | ^ - punctuation * * * * * -| ^^^^^^^^ meta.block-level meta.separator +| ^^^^^^^^ meta.separator _ _ _ _ _ _ _ -| ^^^^^^^^^^^^ meta.block-level meta.separator +| ^^^^^^^^^^^^ meta.separator | ^ punctuation.definition.thematic-break | ^ punctuation.definition.thematic-break | ^ - punctuation - - - - -| <- meta.block-level meta.separator.thematic-break punctuation.definition.thematic-break +| <- meta.separator.thematic-break punctuation.definition.thematic-break |^^ - punctuation | ^ punctuation | ^ punctuation @@ -1064,21 +1064,21 @@ because it doesn't begin with the number one: > Block quote with list items > - list item 1 -| ^ meta.block-level markup.quote punctuation.definition.list_item +| ^ markup.quote punctuation.definition.list_item > - list item 2 | ^ markup.list.unnumbered.bullet punctuation.definition.list_item -| ^^^^^^^^^^^^^^ meta.block-level markup.quote markup.list.unnumbered +| ^^^^^^^^^^^^^^ markup.quote markup.list.unnumbered | ^^^^^^^^^^^^ meta.paragraph.list > 1. sub list item -| <- meta.block-level markup.quote punctuation.definition.blockquote -|^^^^^^^^^^^^^^^^^^^^ meta.block-level markup.quote +| <- markup.quote punctuation.definition.blockquote +|^^^^^^^^^^^^^^^^^^^^ markup.quote | ^ punctuation.definition.list_item | ^^ markup.list.numbered.bullet | ^^^^^^^^^^^^^^^^^^^ markup.list.numbered | ^^^^^^^^^^^^^^ meta.paragraph.list > - list item 3 continued -| ^^^^^^^^^^ meta.block-level.markdown markup.quote.markdown markup.list.unnumbered.markdown meta.paragraph.list.markdown +| ^^^^^^^^^^ markup.quote.markdown markup.list.unnumbered.markdown meta.paragraph.list.markdown * this is a list @@ -1129,7 +1129,7 @@ because it doesn't begin with the number one: | ^^^^^^^^^^^^^^^ - markup.raw > * [ ] task -| ^^^^^^^^^^^ meta.block-level.markdown markup.quote.markdown +| ^^^^^^^^^^^ markup.quote.markdown | ^ markup.list.unnumbered.bullet.markdown | ^^^^^^^^^^ markup.list.unnumbered.markdown | ^ punctuation.definition.list_item.markdown @@ -1137,7 +1137,7 @@ because it doesn't begin with the number one: | ^ markup.checkbox.mark.markdown-gfm - punctuation | ^ markup.checkbox.end.markdown-gfm punctuation.definition.checkbox.end.markdown-gfm > * [x] task -| ^^^^^^^^^^^ meta.block-level.markdown markup.quote.markdown +| ^^^^^^^^^^^ markup.quote.markdown | ^ markup.list.unnumbered.bullet.markdown | ^^^^^^^^^^ markup.list.unnumbered.markdown | ^ punctuation.definition.list_item.markdown @@ -1145,7 +1145,7 @@ because it doesn't begin with the number one: | ^ markup.checkbox.mark.markdown-gfm - punctuation | ^ markup.checkbox.end.markdown-gfm punctuation.definition.checkbox.end.markdown-gfm > * [X] task -| ^^^^^^^^^^^ meta.block-level.markdown markup.quote.markdown +| ^^^^^^^^^^^ markup.quote.markdown | ^ markup.list.unnumbered.bullet.markdown | ^^^^^^^^^^ markup.list.unnumbered.markdown | ^ punctuation.definition.list_item.markdown @@ -1154,7 +1154,7 @@ because it doesn't begin with the number one: | ^ markup.checkbox.end.markdown-gfm punctuation.definition.checkbox.end.markdown-gfm > * [X] task > - [ ] task -| ^^^^^^^^^^^^^ meta.block-level.markdown markup.quote.markdown +| ^^^^^^^^^^^^^ markup.quote.markdown | ^ markup.list.unnumbered.bullet.markdown | ^^^^^^^^^^ markup.list.unnumbered.markdown | ^ punctuation.definition.list_item.markdown @@ -2385,51 +2385,51 @@ abc | <- meta.paragraph - markup.list | foo | bar | -|^^^^^^^^^^^^^ meta.block-level meta.table.header +|^^^^^^^^^^^^^ meta.table.header | <- punctuation.separator.table-cell | ^ punctuation.separator.table-cell | ^ punctuation.separator.table-cell | ^^^^ - punctuation.separator.table-cell | --- | --- | | baz | bim Ctrl+C | -| <- meta.block-level meta.table punctuation.separator.table-cell +| <- meta.table punctuation.separator.table-cell | ^^^^^ meta.tag.inline.any | ^ punctuation.separator.table-cell -| <- - meta.block-level - meta.table +| <- - meta.table | abc | defghi | :-: | -----------: -|^^^^^^^^^^^^^^^^^ meta.block-level meta.table.header-separator +|^^^^^^^^^^^^^^^^^ meta.table.header-separator | <- punctuation.definition.table-cell-alignment |^ punctuation.section.table-header | ^ punctuation.separator.table-cell | ^^^^^^^^^^^ punctuation.section.table-header | ^ punctuation.definition.table-cell-alignment - punctuation.section.table-header bar | baz -| ^ meta.block-level meta.table punctuation.separator.table-cell +| ^ meta.table punctuation.separator.table-cell | f\|oo | -| <- meta.block-level meta.table punctuation.separator.table-cell -| ^^ meta.block-level meta.table constant.character.escape - punctuation.separator.table-cell -| ^ meta.block-level meta.table punctuation.separator.table-cell +| <- meta.table punctuation.separator.table-cell +| ^^ meta.table constant.character.escape - punctuation.separator.table-cell +| ^ meta.table punctuation.separator.table-cell | ------ | | b `|` az | -| ^^^ meta.block-level meta.table markup.raw.inline - meta.table.header-separator -| ^ meta.block-level meta.table punctuation.separator.table-cell +| ^^^ meta.table markup.raw.inline - meta.table.header-separator +| ^ meta.table punctuation.separator.table-cell | b **|** im | -| <- meta.block-level meta.table punctuation.separator.table-cell -| ^^^^^ meta.block-level meta.table markup.bold - punctuation.separator.table-cell -| ^ meta.block-level meta.table punctuation.separator.table-cell +| <- meta.table punctuation.separator.table-cell +| ^^^^^ meta.table markup.bold - punctuation.separator.table-cell +| ^ meta.table punctuation.separator.table-cell | abc | def | | --- | --- | | bar | baz | -|^^^^^^^^^^^^^ meta.block-level meta.table +|^^^^^^^^^^^^^ meta.table test -|^^^^ meta.block-level meta.table +|^^^^ meta.table > bar -| <- meta.block-level markup.quote punctuation.definition.blockquote - meta.table +| <- markup.quote punctuation.definition.blockquote - meta.table `|` this `|` example `|` is not a table `|` | ^ punctuation.definition.raw.end - meta.table @@ -2441,7 +2441,7 @@ test | First row | Data | Very long data entry | | Second row | **Cell** | *Cell* | | Third row | Cell that spans across two columns || -| ^^^^^^^^^^^^^^ meta.block-level meta.table +| ^^^^^^^^^^^^^^ meta.table | ^^ punctuation.separator.table-cell | table that doesn't start at column 0 | @@ -2456,26 +2456,26 @@ not a table | abc | def --- | --- --- | --- -| ^^^^ meta.block-level meta.table - meta.table.header +| ^^^^ meta.table - meta.table.header a | b - | - -|^^^^^^ meta.block-level.markdown meta.table.header-separator.markdown-gfm +|^^^^^^ meta.table.header-separator.markdown-gfm |^ punctuation.section.table-header.markdown | ^ punctuation.separator.table-cell.markdown | ^ punctuation.section.table-header.markdown - | - -|^^^^^^ meta.block-level.markdown meta.table.markdown-gfm +|^^^^^^ meta.table.markdown-gfm a | b -:| - -|^^^^^^ meta.block-level.markdown meta.table.header-separator.markdown-gfm +|^^^^^^ meta.table.header-separator.markdown-gfm |^ punctuation.section.table-header.markdown | ^ punctuation.definition.table-cell-alignment.markdown | ^ punctuation.separator.table-cell.markdown | ^ punctuation.section.table-header.markdown - | - -|^^^^^^ meta.block-level.markdown meta.table.markdown-gfm +|^^^^^^ meta.table.markdown-gfm | test | me | |------|----| @@ -2964,14 +2964,14 @@ end | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - constant - keyword - variable -= += /= %= -- ++ ** !~ =~ ~~ <= >= => <=> // && == != -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block-level markup.raw - constant - keyword - variable - punctuation +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.raw - constant - keyword - variable - punctuation > -= += /= %= -- ++ ** !~ =~ ~~ <= >= => <=> // && == != -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block-level - constant - keyword - variable +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - constant - keyword - variable > > -= += /= %= -- ++ ** !~ =~ ~~ <= >= => <=> // && == != -| ^ meta.block-level.markdown markup.quote.markdown markup.quote.markdown punctuation.definition.blockquote.markdown -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block-level - constant - keyword - variable +| ^ markup.quote.markdown markup.quote.markdown punctuation.definition.blockquote.markdown +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - constant - keyword - variable \
|<- constant.character.escape From 60083357e0081f7196c2798e8e541077227f8e5a Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Tue, 21 Sep 2021 18:16:48 +0200 Subject: [PATCH 09/56] Syntax: Reorganize inline context --- syntaxes/Markdown.sublime-syntax | 72 ++++++++++++++++---------------- 1 file changed, 35 insertions(+), 37 deletions(-) diff --git a/syntaxes/Markdown.sublime-syntax b/syntaxes/Markdown.sublime-syntax index 4f4818f4..2a1c95e2 100644 --- a/syntaxes/Markdown.sublime-syntax +++ b/syntaxes/Markdown.sublime-syntax @@ -658,34 +658,6 @@ contexts: pop: true - include: inline-bold-italic - inline: - - include: escape - - include: ampersand - - include: critic-inline - - include: ligatures - - include: bracket - - include: code-spans - - include: autolink-email - - include: autolink-inet - - include: image-inline - - include: image-ref - - include: link-ref-wiki - - include: link-ref-footnote - - include: link-ref-literal - - include: link-inline - - include: link-ref - - include: latex-inline - - inline-bold-italic: - - include: inline - - include: bold - - include: italic - - include: strikethrough - - inline-bold-italic-linebreak: - - include: inline-bold-italic - - include: hard-line-break - italic: - match: '\*(?=\S)(?!\*)' scope: punctuation.definition.italic.begin.markdown @@ -2205,6 +2177,36 @@ contexts: - match: \n pop: true +###[ INLINE ]################################################################# + + inline: + - include: escape + - include: ampersand + - include: critic-inline + - include: ligatures + - include: bracket + - include: code-spans + - include: autolink-email + - include: autolink-inet + - include: image-inline + - include: image-ref + - include: link-ref-wiki + - include: link-ref-footnote + - include: link-ref-literal + - include: link-inline + - include: link-ref + - include: latex-inline + + inline-bold-italic: + - include: inline + - include: bold + - include: italic + - include: strikethrough + + inline-bold-italic-linebreak: + - include: inline-bold-italic + - include: hard-line-break + ###[ INLINE: CODE SPANS ]##################################################### code-spans: @@ -2224,7 +2226,7 @@ contexts: pop: true - include: paragraph-end -###[ INLINE IMAGES ]########################################################## +###[ INLINE: IMAGES ]######################################################### image-inline: - match: \!\[(?={{balance_square_brackets}}?\]\() @@ -2282,8 +2284,6 @@ contexts: - meta_scope: meta.image.inline.attributes.markdown - include: tag-attributes -###[ IMAGE REFERENCES ]####################################################### - image-ref: - match: \!\[(?={{balance_square_brackets}}?\]\[{{reference_name}}\]) scope: punctuation.definition.image.begin.markdown @@ -2320,7 +2320,7 @@ contexts: - meta_scope: meta.image.reference.markdown - include: tag-attributes -###[ INLINE LINKS ]########################################################### +###[ INLINE: LINKS ]########################################################## link-inline: - match: \[(?={{balance_square_brackets}}?\]\() @@ -2378,8 +2378,6 @@ contexts: - meta_scope: meta.link.inline.attributes.markdown - include: tag-attributes -###[ LINK REFERENCES ]######################################################## - link-ref: - match: \[(?={{balance_square_brackets}}?\]\[{{reference_name}}\]) scope: punctuation.definition.link.begin.markdown @@ -2475,7 +2473,7 @@ contexts: pop: true - include: link-text-allow-image -###[ LINK/IMAGE PROTOTYPES ]################################################## +###[ INLINE: LINK/IMAGE PROTOTYPES ]########################################## link-text: - match: \b__?(?=[^]_]+\]) # eat underscores where there is no pair before the end of the square brackets - it's not a formatting mark @@ -2574,7 +2572,7 @@ contexts: scope: punctuation.separator.path.markdown pop: true -###[ LINK/IMAGE/REFERENCE ATTRIBUTES ]######################################## +###[ INLINE: LINK/IMAGE/REFERENCE ATTRIBUTES ]################################ tag-attributes: # https://kramdown.gettalong.org/syntax.html#span-ials @@ -2629,7 +2627,7 @@ contexts: scope: invalid.illegal.attribute-value.markdown - include: else-pop -###[ AUTOLINKS ]############################################################## +###[ INLINE: AUTOLINKS ]###################################################### autolink-email: # CommonMark From 5bcda912ad31206edff336975e093f1b79aa77a0 Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Tue, 21 Sep 2021 18:21:01 +0200 Subject: [PATCH 10/56] Syntax: Reorganize headings and paragraph contexts --- syntaxes/Markdown.sublime-syntax | 257 ++++++++++++++++--------------- 1 file changed, 131 insertions(+), 126 deletions(-) diff --git a/syntaxes/Markdown.sublime-syntax b/syntaxes/Markdown.sublime-syntax index 2a1c95e2..18fb6b9a 100644 --- a/syntaxes/Markdown.sublime-syntax +++ b/syntaxes/Markdown.sublime-syntax @@ -250,62 +250,6 @@ contexts: - include: fenced-code-blocks - include: setext-heading-or-paragraph - setext-heading-or-paragraph: - # A paragraph may start with a line of equal signs which must not be matched - # as heading underline. This is achieved by consuming them here, which also - # applies `meta.paragraph` scope as expected. - # A line of dashes is already matched as thematic break and thus ignored. - - match: ^[ ]{,3}(?:=+|(?=\S)) - push: paragraph - - setext-heading1: - - match: ^[ ]{,3}(=+)[ \t]*$(\n?) - scope: markup.heading.1.setext.markdown - captures: - 1: punctuation.definition.heading.setext.markdown - 2: meta.whitespace.newline.markdown - pop: true - - setext-heading2: - - match: ^[ ]{,3}(-+)[ \t]*$(\n?) - scope: markup.heading.2.setext.markdown - captures: - 1: punctuation.definition.heading.setext.markdown - 2: meta.whitespace.newline.markdown - pop: true - - paragraph: - - meta_scope: meta.paragraph.markdown - - include: setext-heading1 - - include: setext-heading2 - - include: paragraph-end - - include: inline-bold-italic-linebreak - - include: tag-kbd - - include: scope:text.html.basic - - paragraph-end: - - match: |- - (?x) # pop out of this context if one of the following conditions are met: - ^(?= - \s*$ # the line is blank (or only contains whitespace) - | {{atx_heading}} # an ATX heading begins the line - | {{block_quote}} # a blockquote begins the line - | {{fenced_code_block_start}} # a fenced codeblock begins the line - | {{thematic_break}} # line is a thematic beak - | [ ]{,3}1[.)]\s # an ordered list item with number "1" begins the line - | [ ]{,3}[*+-]\s # an unordered list item begins the line - | [ ]{,3}<(?: # all types of HTML blocks except type 7 may interrupt a paragraph - {{html_tag_block_end_at_close_tag}} # 1 - | !-- # 2 - | \? # 3 - | ![A-Z] # 4 - | !\[CDATA\[ # 5 - | {{html_tag_block_end_at_blank_line}} # 6 - ) - | [ ]{,3}\$\$ # a latex math block - ) - pop: true - ampersand: - match: (?!{{html_entity}})& comment: | @@ -588,76 +532,6 @@ contexts: - match: '{{escape}}' scope: constant.character.escape.markdown - atx-heading: - # https://spec.commonmark.org/0.30/#atx-headings - # Note: - # Consume spaces and tabs after opening hashes so entity.name - # starts with first non-whitespace character, - # but don't do so if directly followed by closing hashes - # as terminator pattern requires them to match then. - - match: '[ ]{,3}(#{1}){{atx_heading_space}}' - captures: - 1: punctuation.definition.heading.begin.markdown - push: atx-heading1-content - - match: '[ ]{,3}(#{2}){{atx_heading_space}}' - captures: - 1: punctuation.definition.heading.begin.markdown - push: atx-heading2-content - - match: '[ ]{,3}(#{3}){{atx_heading_space}}' - captures: - 1: punctuation.definition.heading.begin.markdown - push: atx-heading3-content - - match: '[ ]{,3}(#{4}){{atx_heading_space}}' - captures: - 1: punctuation.definition.heading.begin.markdown - push: atx-heading4-content - - match: '[ ]{,3}(#{5}){{atx_heading_space}}' - captures: - 1: punctuation.definition.heading.begin.markdown - push: atx-heading5-content - - match: '[ ]{,3}(#{6}){{atx_heading_space}}' - captures: - 1: punctuation.definition.heading.begin.markdown - push: atx-heading6-content - - atx-heading1-content: - - meta_scope: markup.heading.1.markdown - - meta_content_scope: entity.name.section.markdown - - include: atx-heading-content - - atx-heading2-content: - - meta_scope: markup.heading.2.markdown - - meta_content_scope: entity.name.section.markdown - - include: atx-heading-content - - atx-heading3-content: - - meta_scope: markup.heading.3.markdown - - meta_content_scope: entity.name.section.markdown - - include: atx-heading-content - - atx-heading4-content: - - meta_scope: markup.heading.4.markdown - - meta_content_scope: entity.name.section.markdown - - include: atx-heading-content - - atx-heading5-content: - - meta_scope: markup.heading.5.markdown - - meta_content_scope: entity.name.section.markdown - - include: atx-heading-content - - atx-heading6-content: - - meta_scope: markup.heading.6.markdown - - meta_content_scope: entity.name.section.markdown - - include: atx-heading-content - - atx-heading-content: - - match: '{{atx_heading_end}}' - captures: - 1: punctuation.definition.heading.end.markdown - 2: meta.whitespace.newline.markdown - pop: true - - include: inline-bold-italic - italic: - match: '\*(?=\S)(?!\*)' scope: punctuation.definition.italic.begin.markdown @@ -823,6 +697,137 @@ contexts: - match: $ pop: true +###[ LEAF BLOCKS: ATX HEADINGS ]############################################## + + atx-heading: + # https://spec.commonmark.org/0.30/#atx-headings + # Note: + # Consume spaces and tabs after opening hashes so entity.name + # starts with first non-whitespace character, + # but don't do so if directly followed by closing hashes + # as terminator pattern requires them to match then. + - match: '[ ]{,3}(#{1}){{atx_heading_space}}' + captures: + 1: punctuation.definition.heading.begin.markdown + push: atx-heading1-content + - match: '[ ]{,3}(#{2}){{atx_heading_space}}' + captures: + 1: punctuation.definition.heading.begin.markdown + push: atx-heading2-content + - match: '[ ]{,3}(#{3}){{atx_heading_space}}' + captures: + 1: punctuation.definition.heading.begin.markdown + push: atx-heading3-content + - match: '[ ]{,3}(#{4}){{atx_heading_space}}' + captures: + 1: punctuation.definition.heading.begin.markdown + push: atx-heading4-content + - match: '[ ]{,3}(#{5}){{atx_heading_space}}' + captures: + 1: punctuation.definition.heading.begin.markdown + push: atx-heading5-content + - match: '[ ]{,3}(#{6}){{atx_heading_space}}' + captures: + 1: punctuation.definition.heading.begin.markdown + push: atx-heading6-content + + atx-heading1-content: + - meta_scope: markup.heading.1.markdown + - meta_content_scope: entity.name.section.markdown + - include: atx-heading-content + + atx-heading2-content: + - meta_scope: markup.heading.2.markdown + - meta_content_scope: entity.name.section.markdown + - include: atx-heading-content + + atx-heading3-content: + - meta_scope: markup.heading.3.markdown + - meta_content_scope: entity.name.section.markdown + - include: atx-heading-content + + atx-heading4-content: + - meta_scope: markup.heading.4.markdown + - meta_content_scope: entity.name.section.markdown + - include: atx-heading-content + + atx-heading5-content: + - meta_scope: markup.heading.5.markdown + - meta_content_scope: entity.name.section.markdown + - include: atx-heading-content + + atx-heading6-content: + - meta_scope: markup.heading.6.markdown + - meta_content_scope: entity.name.section.markdown + - include: atx-heading-content + + atx-heading-content: + - match: '{{atx_heading_end}}' + captures: + 1: punctuation.definition.heading.end.markdown + 2: meta.whitespace.newline.markdown + pop: true + - include: inline-bold-italic + +###[ LEAF BLOCKS: SETEXT HEADINGS OR PARAGRAPH ]############################## + + setext-heading-or-paragraph: + # https://spec.commonmark.org/0.30/#setext-headings + # A paragraph may start with a line of equal signs which must not be matched + # as heading underline. This is achieved by consuming them here, which also + # applies `meta.paragraph` scope as expected. + # A line of dashes is already matched as thematic break and thus ignored. + - match: ^[ ]{,3}(?:=+|(?=\S)) + push: paragraph + + setext-heading1: + - match: ^[ ]{,3}(=+)[ \t]*$(\n?) + scope: markup.heading.1.setext.markdown + captures: + 1: punctuation.definition.heading.setext.markdown + 2: meta.whitespace.newline.markdown + pop: true + + setext-heading2: + - match: ^[ ]{,3}(-+)[ \t]*$(\n?) + scope: markup.heading.2.setext.markdown + captures: + 1: punctuation.definition.heading.setext.markdown + 2: meta.whitespace.newline.markdown + pop: true + + paragraph: + - meta_scope: meta.paragraph.markdown + - include: setext-heading1 + - include: setext-heading2 + - include: paragraph-end + - include: inline-bold-italic-linebreak + - include: tag-kbd + - include: scope:text.html.basic + + paragraph-end: + - match: |- + (?x) # pop out of this context if one of the following conditions are met: + ^(?= + \s*$ # the line is blank (or only contains whitespace) + | {{atx_heading}} # an ATX heading begins the line + | {{block_quote}} # a blockquote begins the line + | {{fenced_code_block_start}} # a fenced codeblock begins the line + | {{thematic_break}} # line is a thematic beak + | [ ]{,3}1[.)]\s # an ordered list item with number "1" begins the line + | [ ]{,3}[*+-]\s # an unordered list item begins the line + | [ ]{,3}<(?: # all types of HTML blocks except type 7 may interrupt a paragraph + {{html_tag_block_end_at_close_tag}} # 1 + | !-- # 2 + | \? # 3 + | ![A-Z] # 4 + | !\[CDATA\[ # 5 + | {{html_tag_block_end_at_blank_line}} # 6 + ) + | [ ]{,3}\$\$ # a latex math block + ) + pop: true + ###[ LEAF BLOCKS: INDENTED CODE BLOCKS ]###################################### indented-code-block: From b460b4e93868fdab48564670b427b071aea63725 Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Wed, 22 Sep 2021 21:54:28 +0200 Subject: [PATCH 11/56] Syntax: Reorganize inline element contexts --- syntaxes/Markdown.sublime-syntax | 84 ++++++++++++++++---------------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/syntaxes/Markdown.sublime-syntax b/syntaxes/Markdown.sublime-syntax index 18fb6b9a..877493e1 100644 --- a/syntaxes/Markdown.sublime-syntax +++ b/syntaxes/Markdown.sublime-syntax @@ -250,22 +250,6 @@ contexts: - include: fenced-code-blocks - include: setext-heading-or-paragraph - ampersand: - - match: (?!{{html_entity}})& - comment: | - Markdown will convert this for us. We match it so that the - HTML grammar will not mark it up as invalid. - scope: meta.other.valid-ampersand.markdown - - ligatures: - - match: '?' # <- <-- <--- <-> <--> <---> - # <= <== <=== <=> <==> <===> - - match: '>(-+|=+)[<>]?' # >- >-- >--- >-> >--> >---> >-< >--< >---< - # >= >== >=== >=> >==> >===> >=< >==< >===< - - match: '<<+|<>|>>+' # << <<< <<<< <> >>>> >>> >> - block-quotes: # https://spec.commonmark.org/0.30/#block-quotes - match: ^{{block_quote}} @@ -521,17 +505,6 @@ contexts: - include: italic - include: strikethrough - bracket: - - match: '<(?![A-Za-z/?!$])' - comment: | - Markdown will convert this for us. We match it so that the - HTML grammar will not mark it up as invalid. - scope: meta.other.valid-bracket.markdown - - escape: - - match: '{{escape}}' - scope: constant.character.escape.markdown - italic: - match: '\*(?=\S)(?!\*)' scope: punctuation.definition.italic.begin.markdown @@ -587,19 +560,11 @@ contexts: scope: invalid.illegal.non-terminated.bold-italic.markdown pop: true - include: paragraph-end - - include: hard-line-break + - include: hard-line-breaks - include: inline - include: tag-kbd - include: scope:text.html.basic - hard-line-break: - - match: '[ ]{2,}$' - scope: meta.hard-line-break.markdown punctuation.definition.hard-line-break.markdown - - match: '(\\)$\n' - scope: meta.hard-line-break.markdown - captures: - 1: constant.character.escape.markdown - ###[ CONTAINER BLOCKS: LISTS ]################################################ list-blocks: @@ -2185,11 +2150,11 @@ contexts: ###[ INLINE ]################################################################# inline: - - include: escape - - include: ampersand + - include: escapes + - include: ampersands - include: critic-inline - include: ligatures - - include: bracket + - include: brackets - include: code-spans - include: autolink-email - include: autolink-inet @@ -2210,7 +2175,7 @@ contexts: inline-bold-italic-linebreak: - include: inline-bold-italic - - include: hard-line-break + - include: hard-line-breaks ###[ INLINE: CODE SPANS ]##################################################### @@ -2483,7 +2448,7 @@ contexts: link-text: - match: \b__?(?=[^]_]+\]) # eat underscores where there is no pair before the end of the square brackets - it's not a formatting mark - match: \b\*\*?(?=[^]*]+\]) # eat asterisks where there is no pair before the end of the square brackets - it's not a formatting mark - - include: escape + - include: escapes - include: ampersand - include: code-spans - match: \[ # nested square brackets are allowed @@ -2493,7 +2458,7 @@ contexts: pop: true - include: bold - include: italic - - include: hard-line-break + - include: hard-line-breaks - include: tag-kbd - include: scope:text.html.basic @@ -2715,6 +2680,41 @@ contexts: - include: link-url-path-separators - include: link-url-escapes +###[ INLINE: OTHER ]########################################################## + + ampersands: + # Markdown will convert this for us. We match it so that the + # HTML grammar will not mark it up as invalid. + - match: (?!{{html_entity}})& + scope: meta.other.valid-ampersand.markdown + + brackets: + # Markdown will convert this for us. We match it so that the + # HTML grammar will not mark it up as invalid. + - match: <(?![A-Za-z/?!$]) + scope: meta.other.valid-bracket.markdown + + escapes: + - match: '{{escape}}' + scope: constant.character.escape.markdown + + ligatures: + - match: '?' # <- <-- <--- <-> <--> <---> + # <= <== <=== <=> <==> <===> + - match: '>(-+|=+)[<>]?' # >- >-- >--- >-> >--> >---> >-< >--< >---< + # >= >== >=== >=> >==> >===> >=< >==< >===< + - match: '<<+|<>|>>+' # << <<< <<<< <> >>>> >>> >> + + hard-line-breaks: + - match: '[ ]{2,}$' + scope: meta.hard-line-break.markdown punctuation.definition.hard-line-break.markdown + - match: (\\)\n + captures: + 0: meta.hard-line-break.markdown + 1: constant.character.escape.markdown + ###[ LEAF BLOCKS: TABLES ]#################################################### tables: From 45fdedf887bc58a6f0c1e53b55e140f2930efdd1 Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Fri, 24 Sep 2021 21:13:20 +0200 Subject: [PATCH 12/56] Syntax: Fix balanced parens in link urls addresses https://github.com/sublimehq/Packages/issues/2857 Note: Needs some more work to exclude the following from being scoped as links, but that will require branching. [a]( [a](c) --- syntaxes/Markdown.sublime-syntax | 8 ++++++ tests/syntax_test_markdown.md | 48 ++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) diff --git a/syntaxes/Markdown.sublime-syntax b/syntaxes/Markdown.sublime-syntax index 877493e1..a483eaf8 100644 --- a/syntaxes/Markdown.sublime-syntax +++ b/syntaxes/Markdown.sublime-syntax @@ -2515,9 +2515,17 @@ contexts: link-url-unquoted: - match: (?=[ \t)]) pop: true + - match: \( + push: link-url-unquoted-parens - include: link-url-common + link-url-unquoted-parens: + - match: \) + pop: true + - include: link-url-unquoted + link-url-common: + - include: escapes - include: link-url-path-separators - include: link-url-scheme-separators - include: link-url-escapes diff --git a/tests/syntax_test_markdown.md b/tests/syntax_test_markdown.md index 618b1994..ad755ca0 100644 --- a/tests/syntax_test_markdown.md +++ b/tests/syntax_test_markdown.md @@ -209,6 +209,54 @@ Here is a [](https://example.com){_attr="value"}. | ^^^^^^^ string.quoted.double.markdown | ^ punctuation.definition.attributes.end.markdown +Here is a [link](#with_(parens/inside)_urls). +| ^^^^^^ meta.link.inline.description.markdown +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.inline.metadata.markdown +| ^^ - meta.link +| ^ punctuation.definition.metadata.begin.markdown +| ^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.markdown +| ^ punctuation.definition.metadata.end.markdown + +Here is a [link](\(foo\)). +| ^^^^^^ meta.link.inline.description.markdown +| ^^^^^^^^^ meta.link.inline.metadata.markdown +| ^^ - meta.link +| ^ punctuation.definition.metadata.begin.markdown +| ^^^^^^^ markup.underline.link.markdown +| ^^ constant.character.escape.markdown +| ^^ constant.character.escape.markdown +| ^ punctuation.definition.metadata.end.markdown + +Here is a [link](foo\)\:). +| ^^^^^^ meta.link.inline.description.markdown +| ^^^^^^^^^ meta.link.inline.metadata.markdown +| ^^ - meta.link +| ^ punctuation.definition.metadata.begin.markdown +| ^^^^^^^ markup.underline.link.markdown +| ^^ constant.character.escape.markdown +| ^ punctuation.definition.metadata.end.markdown + +Here is a [link](). +| ^^^^^^ meta.link.inline.description.markdown +| ^^^^^^^^^^^^^^^^ meta.link.inline.metadata.markdown +| ^^ - meta.link +| ^ punctuation.definition.metadata.begin.markdown +| ^ punctuation.definition.link.begin.markdown +| ^^^^^^^^^^^^ markup.underline.link.markdown +| ^ punctuation.definition.link.end.markdown +| ^ punctuation.definition.metadata.end.markdown + +Here is a [link](http://example.com?foo=3#frag). +| ^^^^^^ meta.link.inline.description.markdown +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.inline.metadata.markdown +| ^^ - meta.link +| ^ punctuation.definition.metadata.begin.markdown +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.markdown +| ^^^ punctuation.separator.path.markdown +| ^ punctuation.separator.path.markdown +| ^ punctuation.separator.path.markdown +| ^ punctuation.definition.metadata.end.markdown + Not a [link] (url) due to space. | ^^^^^^ meta.link.reference.description.markdown | ^^^^^^^^^^^^^^^^^^^^^ - meta.link From cff12f271268f83059dfef0dee9473f364991e79 Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Tue, 5 Oct 2021 18:32:20 +0200 Subject: [PATCH 13/56] Syntax: Rename extensions sections --- syntaxes/Markdown.sublime-syntax | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/syntaxes/Markdown.sublime-syntax b/syntaxes/Markdown.sublime-syntax index a483eaf8..bcdead79 100644 --- a/syntaxes/Markdown.sublime-syntax +++ b/syntaxes/Markdown.sublime-syntax @@ -2786,7 +2786,7 @@ contexts: - match: \| scope: punctuation.separator.table-cell.markdown -###[ CRITIC MARKUP ]########################################################## +###[ EXTENSIONS: CRITIC MARKUP ]############################################## critic-inline: # inline critic markup @@ -2878,7 +2878,7 @@ contexts: pop: true - include: inline-bold-italic -###[ LATEX ]################################################################## +###[ EXTENSIONS: LATEX ]###################################################### latex-inline: - match: \\\$ From f2d3d23bc9ea99c8ba5fe3aa82b0f65aba89d262 Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Tue, 5 Oct 2021 18:34:56 +0200 Subject: [PATCH 14/56] Syntax: Reorganize basic text formatting contexts Moves all related contexts into a dedicated section in the inline area. --- syntaxes/Markdown.sublime-syntax | 401 ++++++++++++++++--------------- 1 file changed, 202 insertions(+), 199 deletions(-) diff --git a/syntaxes/Markdown.sublime-syntax b/syntaxes/Markdown.sublime-syntax index bcdead79..cfd38d83 100644 --- a/syntaxes/Markdown.sublime-syntax +++ b/syntaxes/Markdown.sublime-syntax @@ -366,205 +366,6 @@ contexts: - include: tag-kbd - include: scope:text.html.basic - bold: - - include: ligatures - - match: '(\*\*)(\*)(?=\S)(?!\*)' - captures: - 1: punctuation.definition.bold.begin.markdown - 2: markup.italic.markdown punctuation.definition.italic.begin.markdown - push: - - meta_scope: markup.bold.markdown - - meta_content_scope: markup.italic.markdown - - match: |- - (?x) - [ \t]*\*{4,} # if there are more than 3 its not applicable to be bold or italic - | [ \t]+\*(?!\*) # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) - | ^\*(?!\*) # emphasis can't be closed at the start of the line - - match: (\*)(\*\*) - captures: - 1: markup.italic.markdown punctuation.definition.italic.end.markdown - 2: punctuation.definition.bold.end.markdown - pop: true - - match: \*\* - scope: punctuation.definition.bold.end.markdown - set: - - meta_content_scope: markup.italic.markdown - - match: |- - (?x) - [ \t]*\*{3,} # if there are more than 3 its not applicable to be bold or italic - | [ \t]+\*\*+ # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) - | ^\*\* # emphasis can't be closed at the start of the line - - match: \* - scope: markup.italic.markdown punctuation.definition.italic.end.markdown - pop: true - - include: format-common - - include: bold - - include: strikethrough - - match: \* - scope: punctuation.definition.italic.end.markdown - set: - - meta_content_scope: markup.bold.markdown - - match: |- - (?x) - [ \t]*\*{3,} # if there are more than 3 its not applicable to be bold or italic - | [ \t]+\*\*+ # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) - | ^\*\* # emphasis can't be closed at the start of the line - - match: \*\* - scope: markup.bold.markdown punctuation.definition.bold.end.markdown - pop: true - - include: format-common - - include: italic - - include: strikethrough - - include: format-common - - include: strikethrough - - match: '\*\*(?=\S)(?!\*\*|\*\s)' - scope: punctuation.definition.bold.begin.markdown - push: - - meta_scope: markup.bold.markdown - - match: |- - (?x) - [ \t]*\*{4,} # if there are more than 3 its not applicable to be bold or italic - | [ \t]+\*\*+ # whitespace followed by 2 or more is also not applicable - | ^\*\* # emphasis can't be closed at the start of the line - - match: (?:_)?(\*\*) - captures: - 1: punctuation.definition.bold.end.markdown - pop: true - # Consume the underscore that has no corresponding underscore before the closing bold - # punctuation on the same line, as it won't be treated as italic by CommonMark - - match: \b_(?=[^\s_])(?=[^*_]*\*\*) - - include: format-common - - include: italic - - include: strikethrough - - match: '\b(__)(_)(?=\S)(?!_)' - captures: - 1: punctuation.definition.bold.begin.markdown - 2: markup.italic.markdown punctuation.definition.italic.begin.markdown - push: - - meta_scope: markup.bold.markdown - - meta_content_scope: markup.italic.markdown - - match: |- - (?x) - [ \t]*_{4,} # if there are more than 3 its not applicable to be bold or italic - | [ \t]+_(?!_) # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) - | ^_(?!_) # emphasis can't be closed at the start of the line - - match: (_)(__)\b - captures: - 1: markup.italic.markdown punctuation.definition.italic.end.markdown - 2: punctuation.definition.bold.end.markdown - pop: true - - match: _\b - scope: punctuation.definition.italic.end.markdown - set: - - meta_content_scope: markup.bold.markdown - - match: |- - (?x) - [ \t]*_{3,} # if there are more than 3 its not applicable to be bold or italic - | [ \t]+__+ # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) - | ^__ # emphasis can't be closed at the start of the line - - match: __\b - scope: markup.bold.markdown punctuation.definition.bold.end.markdown - pop: true - - include: format-common - - include: italic - - include: strikethrough - - match: __\b - scope: punctuation.definition.bold.end.markdown - set: - - meta_content_scope: markup.italic.markdown - - match: |- - (?x) - [ \t]*_{3,} # if there are more than 3 its not applicable to be bold or italic - | [ \t]+__+ # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) - | ^__ # emphasis can't be closed at the start of the line - - match: _\b - scope: markup.italic.markdown punctuation.definition.italic.end.markdown - pop: true - - include: format-common - - include: bold - - include: strikethrough - - include: format-common - - include: strikethrough - - match: '\b__(?=\S)(?!_[_\s])' - scope: punctuation.definition.bold.begin.markdown - push: - - meta_scope: markup.bold.markdown - - match: |- - (?x) - [ \t]*_{4,} # if there are more than 3 its not applicable to be bold or italic - | [ \t]+__+ # whitespace followed by 2 or more is also not applicable - | ^__ # emphasis can't be closed at the start of the line - - match: (?:\*)?(__\b) - captures: - 1: punctuation.definition.bold.end.markdown - pop: true - # Consume the asterisk that has no corresponding asterisk before the closing bold - # punctuation on the same line, as it won't be treated as italic by CommonMark - - match: \*(?=[^\s*])(?=[^*_]*__\b) - - include: format-common - - include: italic - - include: strikethrough - - italic: - - match: '\*(?=\S)(?!\*)' - scope: punctuation.definition.italic.begin.markdown - push: - - meta_scope: markup.italic.markdown - - match: |- - (?x) - [ \t]*\*{4,} # if there are more than 3 its not applicable to be bold or italic - | [ \t]+\*(?!\*) # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) - | ^\*(?!\*) # emphasis can't be closed at the start of the line - - match: \*(?!\*[^*]) - scope: punctuation.definition.italic.end.markdown - pop: true - - match: \*+ - - include: format-common - - include: bold - - include: strikethrough - - match: '\b_(?=\S)(?!_)' - scope: punctuation.definition.italic.begin.markdown - push: - - meta_scope: markup.italic.markdown - - match: |- - (?x) - [ \t]*_{4,} # if there are more than 3 its not applicable to be bold or italic - | [ \t]+_(?!_) # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) - | ^_(?!_) # emphasis can't be closed at the start of the line - - match: _\b - scope: punctuation.definition.italic.end.markdown - pop: true - - include: format-common - - include: bold - - include: strikethrough - - match: '[*_]+' - - strikethrough: - - match: (?:~(?!~}|>|\s))+ # any number of ~ up to ~> or ~~} critic markers - scope: punctuation.definition.strikethrough.begin.markdown - push: strikethrough-content - - strikethrough-content: - - meta_scope: markup.strikethrough.markdown-gfm - - match: (?:~(?!~}|>))+ # any number of ~ up to ~> or ~~} critic markers - scope: punctuation.definition.strikethrough.end.markdown - pop: true - - include: format-common - - include: bold - - include: italic - - format-common: - - match: '{{setext_escape}}' - pop: true - - match: ^\s*$\n? - scope: invalid.illegal.non-terminated.bold-italic.markdown - pop: true - - include: paragraph-end - - include: hard-line-breaks - - include: inline - - include: tag-kbd - - include: scope:text.html.basic - ###[ CONTAINER BLOCKS: LISTS ]################################################ list-blocks: @@ -2196,6 +1997,208 @@ contexts: pop: true - include: paragraph-end +###[ INLINE: EMPHASIS ]####################################################### + + bold: + # https://spec.commonmark.org/0.30/#emphasis-and-strong-emphasis + - include: ligatures + - match: '(\*\*)(\*)(?=\S)(?!\*)' + captures: + 1: punctuation.definition.bold.begin.markdown + 2: markup.italic.markdown punctuation.definition.italic.begin.markdown + push: + - meta_scope: markup.bold.markdown + - meta_content_scope: markup.italic.markdown + - match: |- + (?x) + [ \t]*\*{4,} # if there are more than 3 its not applicable to be bold or italic + | [ \t]+\*(?!\*) # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) + | ^\*(?!\*) # emphasis can't be closed at the start of the line + - match: (\*)(\*\*) + captures: + 1: markup.italic.markdown punctuation.definition.italic.end.markdown + 2: punctuation.definition.bold.end.markdown + pop: true + - match: \*\* + scope: punctuation.definition.bold.end.markdown + set: + - meta_content_scope: markup.italic.markdown + - match: |- + (?x) + [ \t]*\*{3,} # if there are more than 3 its not applicable to be bold or italic + | [ \t]+\*\*+ # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) + | ^\*\* # emphasis can't be closed at the start of the line + - match: \* + scope: markup.italic.markdown punctuation.definition.italic.end.markdown + pop: true + - include: format-common + - include: bold + - include: strikethrough + - match: \* + scope: punctuation.definition.italic.end.markdown + set: + - meta_content_scope: markup.bold.markdown + - match: |- + (?x) + [ \t]*\*{3,} # if there are more than 3 its not applicable to be bold or italic + | [ \t]+\*\*+ # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) + | ^\*\* # emphasis can't be closed at the start of the line + - match: \*\* + scope: markup.bold.markdown punctuation.definition.bold.end.markdown + pop: true + - include: format-common + - include: italic + - include: strikethrough + - include: format-common + - include: strikethrough + - match: '\*\*(?=\S)(?!\*\*|\*\s)' + scope: punctuation.definition.bold.begin.markdown + push: + - meta_scope: markup.bold.markdown + - match: |- + (?x) + [ \t]*\*{4,} # if there are more than 3 its not applicable to be bold or italic + | [ \t]+\*\*+ # whitespace followed by 2 or more is also not applicable + | ^\*\* # emphasis can't be closed at the start of the line + - match: (?:_)?(\*\*) + captures: + 1: punctuation.definition.bold.end.markdown + pop: true + # Consume the underscore that has no corresponding underscore before the closing bold + # punctuation on the same line, as it won't be treated as italic by CommonMark + - match: \b_(?=[^\s_])(?=[^*_]*\*\*) + - include: format-common + - include: italic + - include: strikethrough + - match: '\b(__)(_)(?=\S)(?!_)' + captures: + 1: punctuation.definition.bold.begin.markdown + 2: markup.italic.markdown punctuation.definition.italic.begin.markdown + push: + - meta_scope: markup.bold.markdown + - meta_content_scope: markup.italic.markdown + - match: |- + (?x) + [ \t]*_{4,} # if there are more than 3 its not applicable to be bold or italic + | [ \t]+_(?!_) # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) + | ^_(?!_) # emphasis can't be closed at the start of the line + - match: (_)(__)\b + captures: + 1: markup.italic.markdown punctuation.definition.italic.end.markdown + 2: punctuation.definition.bold.end.markdown + pop: true + - match: _\b + scope: punctuation.definition.italic.end.markdown + set: + - meta_content_scope: markup.bold.markdown + - match: |- + (?x) + [ \t]*_{3,} # if there are more than 3 its not applicable to be bold or italic + | [ \t]+__+ # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) + | ^__ # emphasis can't be closed at the start of the line + - match: __\b + scope: markup.bold.markdown punctuation.definition.bold.end.markdown + pop: true + - include: format-common + - include: italic + - include: strikethrough + - match: __\b + scope: punctuation.definition.bold.end.markdown + set: + - meta_content_scope: markup.italic.markdown + - match: |- + (?x) + [ \t]*_{3,} # if there are more than 3 its not applicable to be bold or italic + | [ \t]+__+ # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) + | ^__ # emphasis can't be closed at the start of the line + - match: _\b + scope: markup.italic.markdown punctuation.definition.italic.end.markdown + pop: true + - include: format-common + - include: bold + - include: strikethrough + - include: format-common + - include: strikethrough + - match: '\b__(?=\S)(?!_[_\s])' + scope: punctuation.definition.bold.begin.markdown + push: + - meta_scope: markup.bold.markdown + - match: |- + (?x) + [ \t]*_{4,} # if there are more than 3 its not applicable to be bold or italic + | [ \t]+__+ # whitespace followed by 2 or more is also not applicable + | ^__ # emphasis can't be closed at the start of the line + - match: (?:\*)?(__\b) + captures: + 1: punctuation.definition.bold.end.markdown + pop: true + # Consume the asterisk that has no corresponding asterisk before the closing bold + # punctuation on the same line, as it won't be treated as italic by CommonMark + - match: \*(?=[^\s*])(?=[^*_]*__\b) + - include: format-common + - include: italic + - include: strikethrough + + italic: + - match: '\*(?=\S)(?!\*)' + scope: punctuation.definition.italic.begin.markdown + push: + - meta_scope: markup.italic.markdown + - match: |- + (?x) + [ \t]*\*{4,} # if there are more than 3 its not applicable to be bold or italic + | [ \t]+\*(?!\*) # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) + | ^\*(?!\*) # emphasis can't be closed at the start of the line + - match: \*(?!\*[^*]) + scope: punctuation.definition.italic.end.markdown + pop: true + - match: \*+ + - include: format-common + - include: bold + - include: strikethrough + - match: '\b_(?=\S)(?!_)' + scope: punctuation.definition.italic.begin.markdown + push: + - meta_scope: markup.italic.markdown + - match: |- + (?x) + [ \t]*_{4,} # if there are more than 3 its not applicable to be bold or italic + | [ \t]+_(?!_) # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) + | ^_(?!_) # emphasis can't be closed at the start of the line + - match: _\b + scope: punctuation.definition.italic.end.markdown + pop: true + - include: format-common + - include: bold + - include: strikethrough + - match: '[*_]+' + + strikethrough: + - match: (?:~(?!~}|>|\s))+ # any number of ~ up to ~> or ~~} critic markers + scope: punctuation.definition.strikethrough.begin.markdown + push: strikethrough-content + + strikethrough-content: + - meta_scope: markup.strikethrough.markdown-gfm + - match: (?:~(?!~}|>))+ # any number of ~ up to ~> or ~~} critic markers + scope: punctuation.definition.strikethrough.end.markdown + pop: true + - include: format-common + - include: bold + - include: italic + + format-common: + - match: '{{setext_escape}}' + pop: true + - match: ^\s*$\n? + scope: invalid.illegal.non-terminated.bold-italic.markdown + pop: true + - include: paragraph-end + - include: hard-line-breaks + - include: inline + - include: tag-kbd + - include: scope:text.html.basic + ###[ INLINE: IMAGES ]######################################################### image-inline: From 60ae0150d47c24581fff50985e80742b89d7a1de Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Tue, 5 Oct 2021 18:36:04 +0200 Subject: [PATCH 15/56] Syntax: Add block quotes section header --- syntaxes/Markdown.sublime-syntax | 2 ++ 1 file changed, 2 insertions(+) diff --git a/syntaxes/Markdown.sublime-syntax b/syntaxes/Markdown.sublime-syntax index cfd38d83..09d3006b 100644 --- a/syntaxes/Markdown.sublime-syntax +++ b/syntaxes/Markdown.sublime-syntax @@ -250,6 +250,8 @@ contexts: - include: fenced-code-blocks - include: setext-heading-or-paragraph +###[ CONTAINER BLOCKS: BLOCK QUOTES ]######################################### + block-quotes: # https://spec.commonmark.org/0.30/#block-quotes - match: ^{{block_quote}} From 2747867673495cea42c4119b24597931c7c60b92 Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Tue, 5 Oct 2021 18:42:34 +0200 Subject: [PATCH 16/56] Syntax: Add reference definitions comment --- syntaxes/Markdown.sublime-syntax | 1 + 1 file changed, 1 insertion(+) diff --git a/syntaxes/Markdown.sublime-syntax b/syntaxes/Markdown.sublime-syntax index 09d3006b..2d069d38 100644 --- a/syntaxes/Markdown.sublime-syntax +++ b/syntaxes/Markdown.sublime-syntax @@ -1872,6 +1872,7 @@ contexts: ###[ LEAF BLOCKS: LINK REFERENCE DEFINITIONS ]################################ reference-definitions: + # https://spec.commonmark.org/0.30/#link-reference-definitions - include: footnote-definitions - include: link-definitions From 6205d314e431d214ca7cd79b03e1f507064f362d Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Wed, 13 Oct 2021 19:38:20 +0200 Subject: [PATCH 17/56] Syntax: Reorganize bold/italic contexts Create named contexts --- syntaxes/Markdown.sublime-syntax | 328 ++++++++++++++++--------------- 1 file changed, 171 insertions(+), 157 deletions(-) diff --git a/syntaxes/Markdown.sublime-syntax b/syntaxes/Markdown.sublime-syntax index 2d069d38..0a869cc2 100644 --- a/syntaxes/Markdown.sublime-syntax +++ b/syntaxes/Markdown.sublime-syntax @@ -2005,177 +2005,191 @@ contexts: bold: # https://spec.commonmark.org/0.30/#emphasis-and-strong-emphasis - include: ligatures - - match: '(\*\*)(\*)(?=\S)(?!\*)' + - match: (\*\*)(\*)(?=\S)(?!\*) captures: 1: punctuation.definition.bold.begin.markdown 2: markup.italic.markdown punctuation.definition.italic.begin.markdown - push: - - meta_scope: markup.bold.markdown - - meta_content_scope: markup.italic.markdown - - match: |- - (?x) - [ \t]*\*{4,} # if there are more than 3 its not applicable to be bold or italic - | [ \t]+\*(?!\*) # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) - | ^\*(?!\*) # emphasis can't be closed at the start of the line - - match: (\*)(\*\*) - captures: - 1: markup.italic.markdown punctuation.definition.italic.end.markdown - 2: punctuation.definition.bold.end.markdown - pop: true - - match: \*\* - scope: punctuation.definition.bold.end.markdown - set: - - meta_content_scope: markup.italic.markdown - - match: |- - (?x) - [ \t]*\*{3,} # if there are more than 3 its not applicable to be bold or italic - | [ \t]+\*\*+ # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) - | ^\*\* # emphasis can't be closed at the start of the line - - match: \* - scope: markup.italic.markdown punctuation.definition.italic.end.markdown - pop: true - - include: format-common - - include: bold - - include: strikethrough - - match: \* - scope: punctuation.definition.italic.end.markdown - set: - - meta_content_scope: markup.bold.markdown - - match: |- - (?x) - [ \t]*\*{3,} # if there are more than 3 its not applicable to be bold or italic - | [ \t]+\*\*+ # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) - | ^\*\* # emphasis can't be closed at the start of the line - - match: \*\* - scope: markup.bold.markdown punctuation.definition.bold.end.markdown - pop: true - - include: format-common - - include: italic - - include: strikethrough - - include: format-common - - include: strikethrough - - match: '\*\*(?=\S)(?!\*\*|\*\s)' + push: bold-italic-asterisk + - match: \*\*(?=\S)(?!\*\*|\*\s) scope: punctuation.definition.bold.begin.markdown - push: - - meta_scope: markup.bold.markdown - - match: |- - (?x) - [ \t]*\*{4,} # if there are more than 3 its not applicable to be bold or italic - | [ \t]+\*\*+ # whitespace followed by 2 or more is also not applicable - | ^\*\* # emphasis can't be closed at the start of the line - - match: (?:_)?(\*\*) - captures: - 1: punctuation.definition.bold.end.markdown - pop: true - # Consume the underscore that has no corresponding underscore before the closing bold - # punctuation on the same line, as it won't be treated as italic by CommonMark - - match: \b_(?=[^\s_])(?=[^*_]*\*\*) - - include: format-common - - include: italic - - include: strikethrough - - match: '\b(__)(_)(?=\S)(?!_)' + push: bold-asterisk + - match: \b(__)(_)(?=\S)(?!_) captures: 1: punctuation.definition.bold.begin.markdown 2: markup.italic.markdown punctuation.definition.italic.begin.markdown - push: - - meta_scope: markup.bold.markdown - - meta_content_scope: markup.italic.markdown - - match: |- - (?x) - [ \t]*_{4,} # if there are more than 3 its not applicable to be bold or italic - | [ \t]+_(?!_) # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) - | ^_(?!_) # emphasis can't be closed at the start of the line - - match: (_)(__)\b - captures: - 1: markup.italic.markdown punctuation.definition.italic.end.markdown - 2: punctuation.definition.bold.end.markdown - pop: true - - match: _\b - scope: punctuation.definition.italic.end.markdown - set: - - meta_content_scope: markup.bold.markdown - - match: |- - (?x) - [ \t]*_{3,} # if there are more than 3 its not applicable to be bold or italic - | [ \t]+__+ # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) - | ^__ # emphasis can't be closed at the start of the line - - match: __\b - scope: markup.bold.markdown punctuation.definition.bold.end.markdown - pop: true - - include: format-common - - include: italic - - include: strikethrough - - match: __\b - scope: punctuation.definition.bold.end.markdown - set: - - meta_content_scope: markup.italic.markdown - - match: |- - (?x) - [ \t]*_{3,} # if there are more than 3 its not applicable to be bold or italic - | [ \t]+__+ # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) - | ^__ # emphasis can't be closed at the start of the line - - match: _\b - scope: markup.italic.markdown punctuation.definition.italic.end.markdown - pop: true - - include: format-common - - include: bold - - include: strikethrough - - include: format-common - - include: strikethrough - - match: '\b__(?=\S)(?!_[_\s])' + push: bold-italic-underscore + - match: \b__(?=\S)(?!_[_\s]) scope: punctuation.definition.bold.begin.markdown - push: - - meta_scope: markup.bold.markdown - - match: |- - (?x) - [ \t]*_{4,} # if there are more than 3 its not applicable to be bold or italic - | [ \t]+__+ # whitespace followed by 2 or more is also not applicable - | ^__ # emphasis can't be closed at the start of the line - - match: (?:\*)?(__\b) - captures: - 1: punctuation.definition.bold.end.markdown - pop: true - # Consume the asterisk that has no corresponding asterisk before the closing bold - # punctuation on the same line, as it won't be treated as italic by CommonMark - - match: \*(?=[^\s*])(?=[^*_]*__\b) - - include: format-common - - include: italic - - include: strikethrough + push: bold-underscore + + bold-asterisk: + - meta_scope: markup.bold.markdown + - match: |- + (?x) + [ \t]*\*{4,} # if there are more than 3 its not applicable to be bold or italic + | [ \t]+\*\*+ # whitespace followed by 2 or more is also not applicable + | ^\*\* # emphasis can't be closed at the start of the line + - match: (?:_)?(\*\*) + captures: + 1: punctuation.definition.bold.end.markdown + pop: true + # Consume the underscore that has no corresponding underscore before the closing bold + # punctuation on the same line, as it won't be treated as italic by CommonMark + - match: \b_(?=[^\s_])(?=[^*_]*\*\*) + - include: bold-common + + bold-underscore: + - meta_scope: markup.bold.markdown + - match: |- + (?x) + [ \t]*_{4,} # if there are more than 3 its not applicable to be bold or italic + | [ \t]+__+ # whitespace followed by 2 or more is also not applicable + | ^__ # emphasis can't be closed at the start of the line + - match: (?:\*)?(__\b) + captures: + 1: punctuation.definition.bold.end.markdown + pop: true + # Consume the asterisk that has no corresponding asterisk before the closing bold + # punctuation on the same line, as it won't be treated as italic by CommonMark + - match: \*(?=[^\s*])(?=[^*_]*__\b) + - include: bold-common + + bold-italic-asterisk: + - meta_scope: markup.bold.markdown + - meta_content_scope: markup.italic.markdown + - match: |- + (?x) + [ \t]*\*{4,} # if there are more than 3 its not applicable to be bold or italic + | [ \t]+\*(?!\*) # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) + | ^\*(?!\*) # emphasis can't be closed at the start of the line + - match: (\*)(\*\*) + captures: + 1: markup.italic.markdown punctuation.definition.italic.end.markdown + 2: punctuation.definition.bold.end.markdown + pop: true + - match: \*\* + scope: punctuation.definition.bold.end.markdown + set: italic-after-bold-italic-asterisk + - match: \* + scope: punctuation.definition.italic.end.markdown + set: bold-after-bold-italic-asterisk + - include: format-common + - include: strikethrough + + bold-after-bold-italic-asterisk: + - meta_content_scope: markup.bold.markdown + - match: |- + (?x) + [ \t]*\*{3,} # if there are more than 3 its not applicable to be bold or italic + | [ \t]+\*\*+ # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) + | ^\*\* # emphasis can't be closed at the start of the line + - match: \*\* + scope: markup.bold.markdown punctuation.definition.bold.end.markdown + pop: true + - include: bold-common + + italic-after-bold-italic-asterisk: + - meta_content_scope: markup.italic.markdown + - match: |- + (?x) + [ \t]*\*{3,} # if there are more than 3 its not applicable to be bold or italic + | [ \t]+\*\*+ # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) + | ^\*\* # emphasis can't be closed at the start of the line + - match: \* + scope: markup.italic.markdown punctuation.definition.italic.end.markdown + pop: true + - include: italic-common + + bold-italic-underscore: + - meta_scope: markup.bold.markdown + - meta_content_scope: markup.italic.markdown + - match: |- + (?x) + [ \t]*_{4,} # if there are more than 3 its not applicable to be bold or italic + | [ \t]+_(?!_) # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) + | ^_(?!_) # emphasis can't be closed at the start of the line + - match: (_)(__)\b + captures: + 1: markup.italic.markdown punctuation.definition.italic.end.markdown + 2: punctuation.definition.bold.end.markdown + pop: true + - match: _\b + scope: punctuation.definition.italic.end.markdown + set: bold-after-bold-italic-underscore + - match: __\b + scope: punctuation.definition.bold.end.markdown + set: italic-after-bold-italic-underscore + - include: format-common + - include: strikethrough + + bold-after-bold-italic-underscore: + - meta_content_scope: markup.bold.markdown + - match: |- + (?x) + [ \t]*_{3,} # if there are more than 3 its not applicable to be bold or italic + | [ \t]+__+ # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) + | ^__ # emphasis can't be closed at the start of the line + - match: __\b + scope: markup.bold.markdown punctuation.definition.bold.end.markdown + pop: true + - include: bold-common + + italic-after-bold-italic-underscore: + - meta_content_scope: markup.italic.markdown + - match: |- + (?x) + [ \t]*_{3,} # if there are more than 3 its not applicable to be bold or italic + | [ \t]+__+ # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) + | ^__ # emphasis can't be closed at the start of the line + - match: _\b + scope: markup.italic.markdown punctuation.definition.italic.end.markdown + pop: true + - include: italic-common + + bold-common: + - include: format-common + - include: italic + - include: strikethrough italic: - - match: '\*(?=\S)(?!\*)' + - match: \*(?=\S)(?!\*) scope: punctuation.definition.italic.begin.markdown - push: - - meta_scope: markup.italic.markdown - - match: |- - (?x) - [ \t]*\*{4,} # if there are more than 3 its not applicable to be bold or italic - | [ \t]+\*(?!\*) # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) - | ^\*(?!\*) # emphasis can't be closed at the start of the line - - match: \*(?!\*[^*]) - scope: punctuation.definition.italic.end.markdown - pop: true - - match: \*+ - - include: format-common - - include: bold - - include: strikethrough - - match: '\b_(?=\S)(?!_)' + push: italic-asterisk + - match: \b_(?=\S)(?!_) scope: punctuation.definition.italic.begin.markdown - push: - - meta_scope: markup.italic.markdown - - match: |- - (?x) - [ \t]*_{4,} # if there are more than 3 its not applicable to be bold or italic - | [ \t]+_(?!_) # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) - | ^_(?!_) # emphasis can't be closed at the start of the line - - match: _\b - scope: punctuation.definition.italic.end.markdown - pop: true - - include: format-common - - include: bold - - include: strikethrough + push: italic-underscore - match: '[*_]+' + italic-asterisk: + - meta_scope: markup.italic.markdown + - match: |- + (?x) + [ \t]*\*{4,} # if there are more than 3 its not applicable to be bold or italic + | [ \t]+\*(?!\*) # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) + | ^\*(?!\*) # emphasis can't be closed at the start of the line + - match: \*(?!\*[^*]) + scope: punctuation.definition.italic.end.markdown + pop: true + - match: \*+ + - include: italic-common + + italic-underscore: + - meta_scope: markup.italic.markdown + - match: |- + (?x) + [ \t]*_{4,} # if there are more than 3 its not applicable to be bold or italic + | [ \t]+_(?!_) # whitespace followed by 1 is also not applicable (but whitespace followed by 2 could be bold punctuation) + | ^_(?!_) # emphasis can't be closed at the start of the line + - match: _\b + scope: punctuation.definition.italic.end.markdown + pop: true + - include: italic-common + + italic-common: + - include: format-common + - include: bold + - include: strikethrough + strikethrough: - match: (?:~(?!~}|>|\s))+ # any number of ~ up to ~> or ~~} critic markers scope: punctuation.definition.strikethrough.begin.markdown From 9d8a38185291b198f8e9f75b3f5a413e8d304595 Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Thu, 14 Oct 2021 18:38:23 +0200 Subject: [PATCH 18/56] Syntax: Reorganize table section position --- syntaxes/Markdown.sublime-syntax | 128 ++++++++++++++++--------------- 1 file changed, 65 insertions(+), 63 deletions(-) diff --git a/syntaxes/Markdown.sublime-syntax b/syntaxes/Markdown.sublime-syntax index 0a869cc2..4c6378cf 100644 --- a/syntaxes/Markdown.sublime-syntax +++ b/syntaxes/Markdown.sublime-syntax @@ -194,6 +194,8 @@ variables: footnote_name: (?:\^(?:\\\]|[^]])+) reference_name: (?:(?:\\\]|[^]])+) +############################################################################## + contexts: main: @@ -1937,6 +1939,69 @@ contexts: pop: true - include: link-url-common +###[ LEAF BLOCKS: TABLES ]#################################################### + + tables: + - match: ^(?={{table_first_row}}) + push: table-header + + table-header: + - meta_content_scope: meta.table.header.markdown-gfm + - match: \n + set: table-header-separator + - include: table-cell-content + + table-header-separator: + - meta_content_scope: meta.table.header-separator.markdown-gfm + - match: \n + set: table-body + - match: -+ + scope: punctuation.section.table-header.markdown + - match: ':' + scope: punctuation.definition.table-cell-alignment.markdown + - include: table-cell-separators + - include: table-end + + table-body: + - meta_content_scope: meta.table.markdown-gfm + - include: table-end + - include: table-cell-content + + table-end: + # The table is broken at the first empty line, or beginning of another block-level structure + - match: |- + (?x)^ + (?= \s*$ + | {{atx_heading}} + | {{block_quote}} + | {{fenced_code_block_start}} + | {{indented_code_block}} + | {{thematic_break}} + ) + pop: true + + table-cell-content: + - match: (?={{balanced_emphasis}}) + push: table-cell-bold-italic + - match: |- + (?x) + (?!{{backticks}}) + `+ + scope: invalid.deprecated.unescaped-backticks.markdown + - include: table-cell-separators + - include: inline + - include: tag-kbd + - include: scope:text.html.basic + + table-cell-bold-italic: + - include: bold + - include: italic + - include: immediately-pop + + table-cell-separators: + - match: \| + scope: punctuation.separator.table-cell.markdown + ###[ LEAF BLOCKS: THEMATIC BREAKS ]########################################### thematic-breaks: @@ -2743,69 +2808,6 @@ contexts: 0: meta.hard-line-break.markdown 1: constant.character.escape.markdown -###[ LEAF BLOCKS: TABLES ]#################################################### - - tables: - - match: ^(?={{table_first_row}}) - push: table-header - - table-header: - - meta_content_scope: meta.table.header.markdown-gfm - - match: \n - set: table-header-separator - - include: table-cell-content - - table-header-separator: - - meta_content_scope: meta.table.header-separator.markdown-gfm - - match: \n - set: table-body - - match: -+ - scope: punctuation.section.table-header.markdown - - match: ':' - scope: punctuation.definition.table-cell-alignment.markdown - - include: table-cell-separators - - include: table-end - - table-body: - - meta_content_scope: meta.table.markdown-gfm - - include: table-end - - include: table-cell-content - - table-end: - # The table is broken at the first empty line, or beginning of another block-level structure - - match: |- - (?x)^ - (?= \s*$ - | {{atx_heading}} - | {{block_quote}} - | {{fenced_code_block_start}} - | {{indented_code_block}} - | {{thematic_break}} - ) - pop: true - - table-cell-content: - - match: (?={{balanced_emphasis}}) - push: table-cell-bold-italic - - match: |- - (?x) - (?!{{backticks}}) - `+ - scope: invalid.deprecated.unescaped-backticks.markdown - - include: table-cell-separators - - include: inline - - include: tag-kbd - - include: scope:text.html.basic - - table-cell-bold-italic: - - include: bold - - include: italic - - include: immediately-pop - - table-cell-separators: - - match: \| - scope: punctuation.separator.table-cell.markdown - ###[ EXTENSIONS: CRITIC MARKUP ]############################################## critic-inline: From 7cb9b338a541ebe4ae65671e9b3a4f26587e7044 Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Sat, 30 Oct 2021 11:32:00 +0200 Subject: [PATCH 19/56] Syntax: Exclude prototype from some contexts --- syntaxes/Markdown.sublime-syntax | 2 ++ 1 file changed, 2 insertions(+) diff --git a/syntaxes/Markdown.sublime-syntax b/syntaxes/Markdown.sublime-syntax index 4c6378cf..08ba5140 100644 --- a/syntaxes/Markdown.sublime-syntax +++ b/syntaxes/Markdown.sublime-syntax @@ -280,6 +280,7 @@ contexts: - block-quote-content block-quote-meta: + - meta_include_prototype: false - meta_scope: markup.quote.markdown - include: immediately-pop @@ -320,6 +321,7 @@ contexts: push: block-quote-code-block-text block-quote-code-block-text: + - meta_include_prototype: false - meta_content_scope: markup.raw.code-fence.markdown-gfm - match: ^ pop: true From 2b1d3495373049a8b3b43abaa149fa58b67decc2 Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Tue, 2 Nov 2021 18:25:41 +0100 Subject: [PATCH 20/56] Syntax: Refactor lists --- syntaxes/Markdown.sublime-syntax | 110 +++++++++++++++++-------------- 1 file changed, 60 insertions(+), 50 deletions(-) diff --git a/syntaxes/Markdown.sublime-syntax b/syntaxes/Markdown.sublime-syntax index 08ba5140..05bc41ae 100644 --- a/syntaxes/Markdown.sublime-syntax +++ b/syntaxes/Markdown.sublime-syntax @@ -404,70 +404,80 @@ contexts: - include: list-paragraph list-paragraph: - - match: '^(?=(?:[ ]{4}|\t){2,}(?![>+*\s-]))(?={{indented_code_block}})' - push: - - include: indented-code-block - - match: $ - pop: true + - include: list-indended-code-blocks + - include: list-block-quotes + - include: latex-blocks + - include: fenced-code-blocks + - include: reference-definitions + - match: (?=\S) + push: list-items + + list-block-quotes: - match: ^[ ]*{{block_quote}} captures: 1: punctuation.definition.blockquote.markdown push: - block-quote-meta - block-quote-content - - include: latex-blocks - - include: fenced-code-blocks - - include: reference-definitions - - match: \s+(?=\S) - push: - - match: ^\s*$ - pop: true - - match: ([ ]*)([*+-])((?:[ ](\[)([ xX])(\]))?\s) - captures: - 1: markup.list.unnumbered.markdown - 2: markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown - 3: markup.list.unnumbered.markdown - 4: markup.checkbox.begin.markdown-gfm punctuation.definition.checkbox.begin.markdown-gfm - 5: markup.checkbox.mark.markdown-gfm - 6: markup.checkbox.end.markdown-gfm punctuation.definition.checkbox.end.markdown-gfm - push: - - clear_scopes: 1 - - meta_content_scope: markup.list.unnumbered.markdown meta.paragraph.list.markdown - - include: list-content - - match: ([ ]*)(\d+([.)]))(?=\s) - captures: - 1: markup.list.numbered.markdown - 2: markup.list.numbered.bullet.markdown - 3: punctuation.definition.list_item.markdown - push: - - clear_scopes: 1 - - meta_content_scope: markup.list.numbered.markdown meta.paragraph.list.markdown - - include: list-content - - match: \s+ - scope: meta.paragraph.list.markdown - - match: (?=^{{atx_heading}}) - pop: true - - match: (?=\S) - push: list-content - - match: (?=\S) + + list-indended-code-blocks: + # at least 8 chars / 2 tabs + - match: ^{{indented_code_block}}{2,}[^>+*\s-].*$\n? + scope: markup.raw.block.markdown + + list-items: + - match: ^\s*$ pop: true + - match: ([ ]*)([*+-])((?:[ ](\[)([ xX])(\]))?\s) + captures: + 1: markup.list.unnumbered.markdown + 2: markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown + 3: markup.list.unnumbered.markdown + 4: markup.checkbox.begin.markdown-gfm punctuation.definition.checkbox.begin.markdown-gfm + 5: markup.checkbox.mark.markdown-gfm + 6: markup.checkbox.end.markdown-gfm punctuation.definition.checkbox.end.markdown-gfm + push: unordered-list-content + - match: ([ ]*)(\d+([.)]))(?=\s) + captures: + 1: markup.list.numbered.markdown + 2: markup.list.numbered.bullet.markdown + 3: punctuation.definition.list_item.markdown + push: ordered-list-content + - match: \s+ + scope: meta.paragraph.list.markdown + - match: (?=^{{atx_heading}}) + pop: true + - match: (?=\S) + push: list-content + + unordered-list-content: + - clear_scopes: 1 + - meta_content_scope: markup.list.unnumbered.markdown meta.paragraph.list.markdown + - include: list-content + + ordered-list-content: + - clear_scopes: 1 + - meta_content_scope: markup.list.numbered.markdown meta.paragraph.list.markdown + - include: list-content list-content: - meta_content_scope: meta.paragraph.list.markdown - include: latex-blocks - include: fenced-code-blocks + - include: thematic-breaks - match: ^ pop: true - - include: thematic-breaks - - match: (?=\S)(?!{{list_item}}) - push: - - match: (?={{list_item}}) - pop: true - - include: inline-bold-italic-linebreak - - include: tag-kbd - - include: scope:text.html.basic - - match: $ - pop: true + - match: (?=\S) + push: list-text + + list-text: + - include: inline-bold-italic-linebreak + - include: tag-kbd + - include: scope:text.html.basic + - match: $ + pop: true + - match: (?={{list_item}}) + pop: true ###[ LEAF BLOCKS: ATX HEADINGS ]############################################## From 754891c5f3cb0da1a3780b49c753860b89ab661f Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Wed, 3 Nov 2021 20:42:35 +0100 Subject: [PATCH 21/56] Other: prepare changelog --- messages/3.1.0.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 messages/3.1.0.md diff --git a/messages/3.1.0.md b/messages/3.1.0.md new file mode 100644 index 00000000..92df1126 --- /dev/null +++ b/messages/3.1.0.md @@ -0,0 +1,12 @@ +# MarkdownEditing 3.1.0 Changelog + +Your _MarkdownEditing_ plugin is updated. Enjoy new version. For any type of +feedback you can use [GitHub issues][issues]. + +## Bug Fixes + +## New Features + +## Changes + +[issues]: https://github.com/SublimeText-Markdown/MarkdownEditing/issues From 3c8b6ea229571a6251fe745a38aaed9c5b8d8bc4 Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Wed, 3 Nov 2021 20:43:33 +0100 Subject: [PATCH 22/56] Fix: Silently fail with empty wiki page links --- messages/3.1.0.md | 2 ++ plugins/wiki_page.py | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/messages/3.1.0.md b/messages/3.1.0.md index 92df1126..a39ed512 100644 --- a/messages/3.1.0.md +++ b/messages/3.1.0.md @@ -5,6 +5,8 @@ feedback you can use [GitHub issues][issues]. ## Bug Fixes +* Silently fail with empty wiki page links + ## New Features ## Changes diff --git a/plugins/wiki_page.py b/plugins/wiki_page.py index ed27325f..80f13c3c 100644 --- a/plugins/wiki_page.py +++ b/plugins/wiki_page.py @@ -175,10 +175,10 @@ def identify_page_at_cursor(self): def select_page(self, pagename): logger.debug("Open page: %s" % (pagename)) + if not pagename: + return - if pagename: - self.file_list = self.find_files_with_name(pagename) - + self.file_list = self.find_files_with_name(pagename) if len(self.file_list) > 1: self.view.window().show_quick_panel(self.file_list, self.open_selected_file) elif len(self.file_list) == 1: From 24b42698e1b0de629315ec609c65121ed2b6d31b Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Fri, 12 Nov 2021 17:16:55 +0100 Subject: [PATCH 23/56] Fix: Display correct key for decrease heading level command This commit re-order heading level key bindings to display `alt+shift+,` rather than `delete` as bound key in Command Palette. fixes: https://github.com/SublimeText-Markdown/MarkdownEditing/issues/644#issuecomment-966527396 --- Default (Linux).sublime-keymap | 192 +++++++++++++++---------------- Default (OSX).sublime-keymap | 192 +++++++++++++++---------------- Default (Windows).sublime-keymap | 192 +++++++++++++++---------------- messages/3.1.0.md | 1 + 4 files changed, 289 insertions(+), 288 deletions(-) diff --git a/Default (Linux).sublime-keymap b/Default (Linux).sublime-keymap index 6badd4fd..290577b1 100644 --- a/Default (Linux).sublime-keymap +++ b/Default (Linux).sublime-keymap @@ -354,102 +354,6 @@ // Headings // - { "keys": ["alt+k", "alt+keypad0"], "command": "mde_change_headings_level", "args": {"to": 0}, "context": - [ - { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, - { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } - ] - }, - { "keys": ["alt+k", "alt+0"], "command": "mde_change_headings_level", "args": {"to": 0}, "context": - [ - { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, - { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } - ] - }, - { "keys": ["alt+k", "alt+keypad1"], "command": "mde_change_headings_level", "args": {"to": 1}, "context": - [ - { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, - { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } - ] - }, - { "keys": ["alt+k", "alt+1"], "command": "mde_change_headings_level", "args": {"to": 1}, "context": - [ - { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, - { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } - ] - }, - { "keys": ["alt+k", "alt+keypad2"], "command": "mde_change_headings_level", "args": {"to": 2}, "context": - [ - { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, - { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } - ] - }, - { "keys": ["alt+k", "alt+2"], "command": "mde_change_headings_level", "args": {"to": 2}, "context": - [ - { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, - { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } - ] - }, - { "keys": ["alt+k", "alt+keypad3"], "command": "mde_change_headings_level", "args": {"to": 3}, "context": - [ - { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, - { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } - ] - }, - { "keys": ["alt+k", "alt+3"], "command": "mde_change_headings_level", "args": {"to": 3}, "context": - [ - { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, - { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } - ] - }, - { "keys": ["alt+k", "alt+keypad4"], "command": "mde_change_headings_level", "args": {"to": 4}, "context": - [ - { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, - { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } - ] - }, - { "keys": ["alt+k", "alt+4"], "command": "mde_change_headings_level", "args": {"to": 4}, "context": - [ - { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, - { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } - ] - }, - { "keys": ["alt+k", "alt+keypad5"], "command": "mde_change_headings_level", "args": {"to": 5}, "context": - [ - { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, - { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } - ] - }, - { "keys": ["alt+k", "alt+5"], "command": "mde_change_headings_level", "args": {"to": 5}, "context": - [ - { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, - { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } - ] - }, - { "keys": ["alt+k", "alt+keypad6"], "command": "mde_change_headings_level", "args": {"to": 6}, "context": - [ - { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, - { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } - ] - }, - { "keys": ["alt+k", "alt+6"], "command": "mde_change_headings_level", "args": {"to": 6}, "context": - [ - { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, - { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } - ] - }, - { "keys": ["shift+alt+."], "command": "mde_change_headings_level", "args": {"by": 1}, "context": - [ - { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, - { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } - ] - }, - { "keys": ["shift+alt+,"], "command": "mde_change_headings_level", "args": {"by": -1}, "context": - [ - { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, - { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } - ] - }, // If nothing is selected, pressing hash in front of heading label increases level by one { "keys": ["#"], "command": "mde_change_headings_level", "args": {"by": 1}, "context": [ @@ -569,6 +473,102 @@ { "key": "auto_complete_visible", "operator": "equal", "operand": false, "match_all": true } ] }, + { "keys": ["alt+k", "alt+keypad0"], "command": "mde_change_headings_level", "args": {"to": 0}, "context": + [ + { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, + { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } + ] + }, + { "keys": ["alt+k", "alt+0"], "command": "mde_change_headings_level", "args": {"to": 0}, "context": + [ + { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, + { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } + ] + }, + { "keys": ["alt+k", "alt+keypad1"], "command": "mde_change_headings_level", "args": {"to": 1}, "context": + [ + { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, + { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } + ] + }, + { "keys": ["alt+k", "alt+1"], "command": "mde_change_headings_level", "args": {"to": 1}, "context": + [ + { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, + { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } + ] + }, + { "keys": ["alt+k", "alt+keypad2"], "command": "mde_change_headings_level", "args": {"to": 2}, "context": + [ + { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, + { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } + ] + }, + { "keys": ["alt+k", "alt+2"], "command": "mde_change_headings_level", "args": {"to": 2}, "context": + [ + { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, + { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } + ] + }, + { "keys": ["alt+k", "alt+keypad3"], "command": "mde_change_headings_level", "args": {"to": 3}, "context": + [ + { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, + { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } + ] + }, + { "keys": ["alt+k", "alt+3"], "command": "mde_change_headings_level", "args": {"to": 3}, "context": + [ + { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, + { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } + ] + }, + { "keys": ["alt+k", "alt+keypad4"], "command": "mde_change_headings_level", "args": {"to": 4}, "context": + [ + { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, + { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } + ] + }, + { "keys": ["alt+k", "alt+4"], "command": "mde_change_headings_level", "args": {"to": 4}, "context": + [ + { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, + { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } + ] + }, + { "keys": ["alt+k", "alt+keypad5"], "command": "mde_change_headings_level", "args": {"to": 5}, "context": + [ + { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, + { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } + ] + }, + { "keys": ["alt+k", "alt+5"], "command": "mde_change_headings_level", "args": {"to": 5}, "context": + [ + { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, + { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } + ] + }, + { "keys": ["alt+k", "alt+keypad6"], "command": "mde_change_headings_level", "args": {"to": 6}, "context": + [ + { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, + { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } + ] + }, + { "keys": ["alt+k", "alt+6"], "command": "mde_change_headings_level", "args": {"to": 6}, "context": + [ + { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, + { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } + ] + }, + { "keys": ["shift+alt+."], "command": "mde_change_headings_level", "args": {"by": 1}, "context": + [ + { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, + { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } + ] + }, + { "keys": ["shift+alt+,"], "command": "mde_change_headings_level", "args": {"by": -1}, "context": + [ + { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, + { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } + ] + }, { "keys": ["ctrl+shift+alt+pageup"], "command": "mde_goto_previous_heading", "args": {"same_level": true}, "context": [ { "key": "selector", "operator": "equal", "operand": "text.html.markdown", "match_all": true }, diff --git a/Default (OSX).sublime-keymap b/Default (OSX).sublime-keymap index 5651d8a5..5aeeb9c5 100644 --- a/Default (OSX).sublime-keymap +++ b/Default (OSX).sublime-keymap @@ -354,102 +354,6 @@ // Headings // - { "keys": ["alt+k", "alt+keypad0"], "command": "mde_change_headings_level", "args": {"to": 0}, "context": - [ - { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, - { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } - ] - }, - { "keys": ["alt+k", "alt+0"], "command": "mde_change_headings_level", "args": {"to": 0}, "context": - [ - { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, - { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } - ] - }, - { "keys": ["alt+k", "alt+keypad1"], "command": "mde_change_headings_level", "args": {"to": 1}, "context": - [ - { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, - { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } - ] - }, - { "keys": ["alt+k", "alt+1"], "command": "mde_change_headings_level", "args": {"to": 1}, "context": - [ - { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, - { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } - ] - }, - { "keys": ["alt+k", "alt+keypad2"], "command": "mde_change_headings_level", "args": {"to": 2}, "context": - [ - { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, - { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } - ] - }, - { "keys": ["alt+k", "alt+2"], "command": "mde_change_headings_level", "args": {"to": 2}, "context": - [ - { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, - { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } - ] - }, - { "keys": ["alt+k", "alt+keypad3"], "command": "mde_change_headings_level", "args": {"to": 3}, "context": - [ - { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, - { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } - ] - }, - { "keys": ["alt+k", "alt+3"], "command": "mde_change_headings_level", "args": {"to": 3}, "context": - [ - { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, - { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } - ] - }, - { "keys": ["alt+k", "alt+keypad4"], "command": "mde_change_headings_level", "args": {"to": 4}, "context": - [ - { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, - { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } - ] - }, - { "keys": ["alt+k", "alt+4"], "command": "mde_change_headings_level", "args": {"to": 4}, "context": - [ - { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, - { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } - ] - }, - { "keys": ["alt+k", "alt+keypad5"], "command": "mde_change_headings_level", "args": {"to": 5}, "context": - [ - { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, - { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } - ] - }, - { "keys": ["alt+k", "alt+5"], "command": "mde_change_headings_level", "args": {"to": 5}, "context": - [ - { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, - { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } - ] - }, - { "keys": ["alt+k", "alt+keypad6"], "command": "mde_change_headings_level", "args": {"to": 6}, "context": - [ - { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, - { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } - ] - }, - { "keys": ["alt+k", "alt+6"], "command": "mde_change_headings_level", "args": {"to": 6}, "context": - [ - { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, - { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } - ] - }, - { "keys": ["shift+alt+."], "command": "mde_change_headings_level", "args": {"by": 1}, "context": - [ - { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, - { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } - ] - }, - { "keys": ["shift+alt+,"], "command": "mde_change_headings_level", "args": {"by": -1}, "context": - [ - { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, - { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } - ] - }, // If nothing is selected, pressing hash in front of heading label increases level by one { "keys": ["#"], "command": "mde_change_headings_level", "args": {"by": 1}, "context": [ @@ -569,6 +473,102 @@ { "key": "auto_complete_visible", "operator": "equal", "operand": false, "match_all": true } ] }, + { "keys": ["alt+k", "alt+keypad0"], "command": "mde_change_headings_level", "args": {"to": 0}, "context": + [ + { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, + { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } + ] + }, + { "keys": ["alt+k", "alt+0"], "command": "mde_change_headings_level", "args": {"to": 0}, "context": + [ + { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, + { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } + ] + }, + { "keys": ["alt+k", "alt+keypad1"], "command": "mde_change_headings_level", "args": {"to": 1}, "context": + [ + { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, + { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } + ] + }, + { "keys": ["alt+k", "alt+1"], "command": "mde_change_headings_level", "args": {"to": 1}, "context": + [ + { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, + { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } + ] + }, + { "keys": ["alt+k", "alt+keypad2"], "command": "mde_change_headings_level", "args": {"to": 2}, "context": + [ + { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, + { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } + ] + }, + { "keys": ["alt+k", "alt+2"], "command": "mde_change_headings_level", "args": {"to": 2}, "context": + [ + { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, + { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } + ] + }, + { "keys": ["alt+k", "alt+keypad3"], "command": "mde_change_headings_level", "args": {"to": 3}, "context": + [ + { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, + { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } + ] + }, + { "keys": ["alt+k", "alt+3"], "command": "mde_change_headings_level", "args": {"to": 3}, "context": + [ + { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, + { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } + ] + }, + { "keys": ["alt+k", "alt+keypad4"], "command": "mde_change_headings_level", "args": {"to": 4}, "context": + [ + { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, + { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } + ] + }, + { "keys": ["alt+k", "alt+4"], "command": "mde_change_headings_level", "args": {"to": 4}, "context": + [ + { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, + { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } + ] + }, + { "keys": ["alt+k", "alt+keypad5"], "command": "mde_change_headings_level", "args": {"to": 5}, "context": + [ + { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, + { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } + ] + }, + { "keys": ["alt+k", "alt+5"], "command": "mde_change_headings_level", "args": {"to": 5}, "context": + [ + { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, + { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } + ] + }, + { "keys": ["alt+k", "alt+keypad6"], "command": "mde_change_headings_level", "args": {"to": 6}, "context": + [ + { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, + { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } + ] + }, + { "keys": ["alt+k", "alt+6"], "command": "mde_change_headings_level", "args": {"to": 6}, "context": + [ + { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, + { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } + ] + }, + { "keys": ["shift+alt+."], "command": "mde_change_headings_level", "args": {"by": 1}, "context": + [ + { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, + { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } + ] + }, + { "keys": ["shift+alt+,"], "command": "mde_change_headings_level", "args": {"by": -1}, "context": + [ + { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, + { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } + ] + }, { "keys": ["super+ctrl+pageup"], "command": "mde_goto_previous_heading", "args": {"same_level": true}, "context": [ { "key": "selector", "operator": "equal", "operand": "text.html.markdown", "match_all": true }, diff --git a/Default (Windows).sublime-keymap b/Default (Windows).sublime-keymap index 6badd4fd..290577b1 100644 --- a/Default (Windows).sublime-keymap +++ b/Default (Windows).sublime-keymap @@ -354,102 +354,6 @@ // Headings // - { "keys": ["alt+k", "alt+keypad0"], "command": "mde_change_headings_level", "args": {"to": 0}, "context": - [ - { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, - { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } - ] - }, - { "keys": ["alt+k", "alt+0"], "command": "mde_change_headings_level", "args": {"to": 0}, "context": - [ - { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, - { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } - ] - }, - { "keys": ["alt+k", "alt+keypad1"], "command": "mde_change_headings_level", "args": {"to": 1}, "context": - [ - { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, - { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } - ] - }, - { "keys": ["alt+k", "alt+1"], "command": "mde_change_headings_level", "args": {"to": 1}, "context": - [ - { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, - { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } - ] - }, - { "keys": ["alt+k", "alt+keypad2"], "command": "mde_change_headings_level", "args": {"to": 2}, "context": - [ - { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, - { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } - ] - }, - { "keys": ["alt+k", "alt+2"], "command": "mde_change_headings_level", "args": {"to": 2}, "context": - [ - { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, - { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } - ] - }, - { "keys": ["alt+k", "alt+keypad3"], "command": "mde_change_headings_level", "args": {"to": 3}, "context": - [ - { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, - { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } - ] - }, - { "keys": ["alt+k", "alt+3"], "command": "mde_change_headings_level", "args": {"to": 3}, "context": - [ - { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, - { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } - ] - }, - { "keys": ["alt+k", "alt+keypad4"], "command": "mde_change_headings_level", "args": {"to": 4}, "context": - [ - { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, - { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } - ] - }, - { "keys": ["alt+k", "alt+4"], "command": "mde_change_headings_level", "args": {"to": 4}, "context": - [ - { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, - { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } - ] - }, - { "keys": ["alt+k", "alt+keypad5"], "command": "mde_change_headings_level", "args": {"to": 5}, "context": - [ - { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, - { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } - ] - }, - { "keys": ["alt+k", "alt+5"], "command": "mde_change_headings_level", "args": {"to": 5}, "context": - [ - { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, - { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } - ] - }, - { "keys": ["alt+k", "alt+keypad6"], "command": "mde_change_headings_level", "args": {"to": 6}, "context": - [ - { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, - { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } - ] - }, - { "keys": ["alt+k", "alt+6"], "command": "mde_change_headings_level", "args": {"to": 6}, "context": - [ - { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, - { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } - ] - }, - { "keys": ["shift+alt+."], "command": "mde_change_headings_level", "args": {"by": 1}, "context": - [ - { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, - { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } - ] - }, - { "keys": ["shift+alt+,"], "command": "mde_change_headings_level", "args": {"by": -1}, "context": - [ - { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, - { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } - ] - }, // If nothing is selected, pressing hash in front of heading label increases level by one { "keys": ["#"], "command": "mde_change_headings_level", "args": {"by": 1}, "context": [ @@ -569,6 +473,102 @@ { "key": "auto_complete_visible", "operator": "equal", "operand": false, "match_all": true } ] }, + { "keys": ["alt+k", "alt+keypad0"], "command": "mde_change_headings_level", "args": {"to": 0}, "context": + [ + { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, + { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } + ] + }, + { "keys": ["alt+k", "alt+0"], "command": "mde_change_headings_level", "args": {"to": 0}, "context": + [ + { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, + { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } + ] + }, + { "keys": ["alt+k", "alt+keypad1"], "command": "mde_change_headings_level", "args": {"to": 1}, "context": + [ + { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, + { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } + ] + }, + { "keys": ["alt+k", "alt+1"], "command": "mde_change_headings_level", "args": {"to": 1}, "context": + [ + { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, + { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } + ] + }, + { "keys": ["alt+k", "alt+keypad2"], "command": "mde_change_headings_level", "args": {"to": 2}, "context": + [ + { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, + { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } + ] + }, + { "keys": ["alt+k", "alt+2"], "command": "mde_change_headings_level", "args": {"to": 2}, "context": + [ + { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, + { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } + ] + }, + { "keys": ["alt+k", "alt+keypad3"], "command": "mde_change_headings_level", "args": {"to": 3}, "context": + [ + { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, + { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } + ] + }, + { "keys": ["alt+k", "alt+3"], "command": "mde_change_headings_level", "args": {"to": 3}, "context": + [ + { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, + { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } + ] + }, + { "keys": ["alt+k", "alt+keypad4"], "command": "mde_change_headings_level", "args": {"to": 4}, "context": + [ + { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, + { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } + ] + }, + { "keys": ["alt+k", "alt+4"], "command": "mde_change_headings_level", "args": {"to": 4}, "context": + [ + { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, + { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } + ] + }, + { "keys": ["alt+k", "alt+keypad5"], "command": "mde_change_headings_level", "args": {"to": 5}, "context": + [ + { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, + { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } + ] + }, + { "keys": ["alt+k", "alt+5"], "command": "mde_change_headings_level", "args": {"to": 5}, "context": + [ + { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, + { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } + ] + }, + { "keys": ["alt+k", "alt+keypad6"], "command": "mde_change_headings_level", "args": {"to": 6}, "context": + [ + { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, + { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } + ] + }, + { "keys": ["alt+k", "alt+6"], "command": "mde_change_headings_level", "args": {"to": 6}, "context": + [ + { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, + { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } + ] + }, + { "keys": ["shift+alt+."], "command": "mde_change_headings_level", "args": {"by": 1}, "context": + [ + { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, + { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } + ] + }, + { "keys": ["shift+alt+,"], "command": "mde_change_headings_level", "args": {"by": -1}, "context": + [ + { "key": "selector", "operator": "equal", "operand": "text.html.markdown - meta.frontmatter - meta.disable-markdown - markup.raw", "match_all": true }, + { "key": "setting.mde.keymap_disable.set_heading_level", "operand": false } + ] + }, { "keys": ["ctrl+shift+alt+pageup"], "command": "mde_goto_previous_heading", "args": {"same_level": true}, "context": [ { "key": "selector", "operator": "equal", "operand": "text.html.markdown", "match_all": true }, diff --git a/messages/3.1.0.md b/messages/3.1.0.md index a39ed512..98a695ea 100644 --- a/messages/3.1.0.md +++ b/messages/3.1.0.md @@ -6,6 +6,7 @@ feedback you can use [GitHub issues][issues]. ## Bug Fixes * Silently fail with empty wiki page links +* Display correct key for `MarkdownEditing: Decrease Heading Level` in Command Palette ## New Features From a3b1187a811d99b18f4038513f5f106af071585e Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Sun, 14 Nov 2021 11:56:06 +0100 Subject: [PATCH 24/56] Syntax: Add named context for nested link text --- syntaxes/Markdown.sublime-syntax | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/syntaxes/Markdown.sublime-syntax b/syntaxes/Markdown.sublime-syntax index 05bc41ae..03d8c6d4 100644 --- a/syntaxes/Markdown.sublime-syntax +++ b/syntaxes/Markdown.sublime-syntax @@ -2545,20 +2545,22 @@ contexts: link-text: - match: \b__?(?=[^]_]+\]) # eat underscores where there is no pair before the end of the square brackets - it's not a formatting mark - match: \b\*\*?(?=[^]*]+\]) # eat asterisks where there is no pair before the end of the square brackets - it's not a formatting mark + - match: \[ + push: link-text-nested - include: escapes - include: ampersand - include: code-spans - - match: \[ # nested square brackets are allowed - push: - - include: link-text - - match: \] - pop: true - include: bold - include: italic - include: hard-line-breaks - include: tag-kbd - include: scope:text.html.basic + link-text-nested: + - include: link-text + - match: \] + pop: true + link-text-allow-image: - include: link-text - include: image-inline From e03e5b16009b7eaa7aada49b198bcee40b1090a8 Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Tue, 16 Nov 2021 18:11:04 +0100 Subject: [PATCH 25/56] Syntax: Reorganize inline markup contexts --- syntaxes/Markdown.sublime-syntax | 180 ++++++++++++++++--------------- 1 file changed, 93 insertions(+), 87 deletions(-) diff --git a/syntaxes/Markdown.sublime-syntax b/syntaxes/Markdown.sublime-syntax index 03d8c6d4..00ac62c5 100644 --- a/syntaxes/Markdown.sublime-syntax +++ b/syntaxes/Markdown.sublime-syntax @@ -368,9 +368,7 @@ contexts: | {{thematic_break}} ) pop: true - - include: inline-bold-italic-linebreak - - include: tag-kbd - - include: scope:text.html.basic + - include: inline ###[ CONTAINER BLOCKS: LISTS ]################################################ @@ -471,9 +469,7 @@ contexts: push: list-text list-text: - - include: inline-bold-italic-linebreak - - include: tag-kbd - - include: scope:text.html.basic + - include: inline - match: $ pop: true - match: (?={{list_item}}) @@ -549,7 +545,10 @@ contexts: 1: punctuation.definition.heading.end.markdown 2: meta.whitespace.newline.markdown pop: true - - include: inline-bold-italic + - include: emphasis + - include: images + - include: literals + - include: links ###[ LEAF BLOCKS: SETEXT HEADINGS OR PARAGRAPH ]############################## @@ -583,9 +582,7 @@ contexts: - include: setext-heading1 - include: setext-heading2 - include: paragraph-end - - include: inline-bold-italic-linebreak - - include: tag-kbd - - include: scope:text.html.basic + - include: inline paragraph-end: - match: |- @@ -1904,7 +1901,10 @@ contexts: - meta_scope: meta.link.reference.def.footnote.markdown-extra - match: ^(?![ ]{4}|$) pop: true - - include: inline-bold-italic + - include: emphasis + - include: images + - include: literals + - include: links link-definitions: # https://spec.commonmark.org/0.30/#link-reference-definition @@ -1994,20 +1994,17 @@ contexts: table-cell-content: - match: (?={{balanced_emphasis}}) - push: table-cell-bold-italic - - match: |- - (?x) - (?!{{backticks}}) - `+ + push: table-cell-emphasis + - match: (?!{{backticks}})`+ scope: invalid.deprecated.unescaped-backticks.markdown - include: table-cell-separators - - include: inline - - include: tag-kbd - - include: scope:text.html.basic + - include: images + - include: literals + - include: links + - include: markup - table-cell-bold-italic: - - include: bold - - include: italic + table-cell-emphasis: + - include: emphasis - include: immediately-pop table-cell-separators: @@ -2031,32 +2028,43 @@ contexts: ###[ INLINE ]################################################################# inline: + - include: hard-line-breaks + - include: emphasis + - include: images + - include: literals + - include: links + - include: markup + + emphasis: + - include: bold + - include: italic + - include: strikethrough + + images: + - include: image-inline + - include: image-ref + + literals: - include: escapes - include: ampersands - - include: critic-inline + - include: critics - include: ligatures - include: brackets - include: code-spans + + links: - include: autolink-email - include: autolink-inet - - include: image-inline - - include: image-ref - include: link-ref-wiki - include: link-ref-footnote - include: link-ref-literal - include: link-inline - include: link-ref - - include: latex-inline - - inline-bold-italic: - - include: inline - - include: bold - - include: italic - - include: strikethrough - inline-bold-italic-linebreak: - - include: inline-bold-italic - - include: hard-line-breaks + markup: + - include: tag-kbd + - include: html-content + - include: latex-inline ###[ INLINE: CODE SPANS ]##################################################### @@ -2150,7 +2158,7 @@ contexts: - match: \* scope: punctuation.definition.italic.end.markdown set: bold-after-bold-italic-asterisk - - include: format-common + - include: emphasis-common - include: strikethrough bold-after-bold-italic-asterisk: @@ -2196,7 +2204,7 @@ contexts: - match: __\b scope: punctuation.definition.bold.end.markdown set: italic-after-bold-italic-underscore - - include: format-common + - include: emphasis-common - include: strikethrough bold-after-bold-italic-underscore: @@ -2224,7 +2232,7 @@ contexts: - include: italic-common bold-common: - - include: format-common + - include: emphasis-common - include: italic - include: strikethrough @@ -2263,7 +2271,7 @@ contexts: - include: italic-common italic-common: - - include: format-common + - include: emphasis-common - include: bold - include: strikethrough @@ -2277,11 +2285,11 @@ contexts: - match: (?:~(?!~}|>))+ # any number of ~ up to ~> or ~~} critic markers scope: punctuation.definition.strikethrough.end.markdown pop: true - - include: format-common + - include: emphasis-common - include: bold - include: italic - format-common: + emphasis-common: - match: '{{setext_escape}}' pop: true - match: ^\s*$\n? @@ -2289,9 +2297,10 @@ contexts: pop: true - include: paragraph-end - include: hard-line-breaks - - include: inline - - include: tag-kbd - - include: scope:text.html.basic + - include: images + - include: literals + - include: links + - include: markup ###[ INLINE: IMAGES ]######################################################### @@ -2543,18 +2552,13 @@ contexts: ###[ INLINE: LINK/IMAGE PROTOTYPES ]########################################## link-text: - - match: \b__?(?=[^]_]+\]) # eat underscores where there is no pair before the end of the square brackets - it's not a formatting mark - - match: \b\*\*?(?=[^]*]+\]) # eat asterisks where there is no pair before the end of the square brackets - it's not a formatting mark - match: \[ push: link-text-nested - - include: escapes - - include: ampersand - - include: code-spans - - include: bold - - include: italic - - include: hard-line-breaks - - include: tag-kbd - - include: scope:text.html.basic + - match: \b__?(?=[^]_]+\]) # eat underscores where there is no pair before the end of the square brackets - it's not a formatting mark + - match: \b\*\*?(?=[^]*]+\]) # eat asterisks where there is no pair before the end of the square brackets - it's not a formatting mark + - include: emphasis + - include: literals + - include: markup link-text-nested: - include: link-text @@ -2563,8 +2567,7 @@ contexts: link-text-allow-image: - include: link-text - - include: image-inline - - include: image-ref + - include: images link-title: - match: \' @@ -2824,73 +2827,73 @@ contexts: ###[ EXTENSIONS: CRITIC MARKUP ]############################################## - critic-inline: + critics: # inline critic markup # http://criticmarkup.com/spec.php - - include: critic-inline-additions - - include: critic-inline-comments - - include: critic-inline-deletions - - include: critic-inline-highlights - - include: critic-inline-substitutions + - include: critics-additions + - include: critics-comments + - include: critics-deletions + - include: critics-highlights + - include: critics-substitutions - critic-inline-additions: + critics-additions: - match: \{\+\+ scope: punctuation.definition.critic.begin.markdown - push: critic-inline-addition-content + push: critics-addition-content - critic-inline-addition-content: + critics-addition-content: - meta_scope: markup.critic.addition.markdown - meta_content_scope: markup.inserted.critic.markdown - match: \+\+\} scope: punctuation.definition.critic.end.markdown pop: true - - include: critic-inline-common + - include: critics-common - critic-inline-comments: + critics-comments: - match: '{>>' scope: punctuation.definition.critic.begin.markdown - push: critic-inline-comment-content + push: critics-comment-content - critic-inline-comment-content: + critics-comment-content: - meta_scope: markup.critic.comment.markdown - meta_content_scope: comment.critic.markdown - match: '<<}' scope: punctuation.definition.critic.end.markdown pop: true - - include: critic-inline-common + - include: critics-common - critic-inline-deletions: + critics-deletions: - match: '{--' scope: punctuation.definition.critic.begin.markdown - push: critic-inline-deletion-content + push: critics-deletion-content - critic-inline-deletion-content: + critics-deletion-content: - meta_scope: markup.critic.deletion.markdown - meta_content_scope: markup.deleted.critic.markdown - match: '--}' scope: punctuation.definition.critic.end.markdown pop: true - - include: critic-inline-common + - include: critics-common - critic-inline-highlights: + critics-highlights: - match: '{==' scope: punctuation.definition.critic.begin.markdown - push: critic-inline-highlight-content + push: critics-highlight-content - critic-inline-highlight-content: + critics-highlight-content: - meta_scope: markup.critic.highlight.markdown - meta_content_scope: markup.info.critic.markdown - match: '==}' scope: punctuation.definition.critic.end.markdown pop: true - - include: critic-inline-common + - include: critics-common - critic-inline-substitutions: + critics-substitutions: - match: '{~~' scope: punctuation.definition.critic.begin.markdown - push: critic-inline-substitution-deleted + push: critics-substitution-deleted - critic-inline-substitution-deleted: + critics-substitution-deleted: - meta_scope: markup.critic.substitution.markdown - meta_content_scope: markup.deleted.critic.markdown - match: (?=~>) @@ -2898,21 +2901,24 @@ contexts: - meta_include_prototype: false - match: '~>' scope: punctuation.separator.critic.markdown - set: critic-inline-substitution-inserted - - include: critic-inline-substitution-inserted + set: critics-substitution-inserted + - include: critics-substitution-inserted - critic-inline-substitution-inserted: + critics-substitution-inserted: - meta_scope: markup.critic.substitution.markdown - meta_content_scope: markup.inserted.critic.markdown - match: '~~}' scope: punctuation.definition.critic.end.markdown pop: true - - include: critic-inline-common + - include: critics-common - critic-inline-common: + critics-common: - match: ^(?=\s*$) pop: true - - include: inline-bold-italic + - include: emphasis + - include: images + - include: literals + - include: links ###[ EXTENSIONS: LATEX ]###################################################### From 0ea95ef0641f54cae24321ec181bbca7e5d3df70 Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Tue, 16 Nov 2021 19:04:12 +0100 Subject: [PATCH 26/56] Syntax: Reduce embedded syntax dependencies from tests Some applied or pending changes of sublimehq/Packages drive existing syntax tests invalid. --- tests/syntax_test_markdown.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/syntax_test_markdown.md b/tests/syntax_test_markdown.md index ad755ca0..dc8cbb6d 100644 --- a/tests/syntax_test_markdown.md +++ b/tests/syntax_test_markdown.md @@ -2928,8 +2928,7 @@ okay |^^^^^ meta.code-fence.definition.begin.sql | ^^^ constant.other.language-name SELECT TOP 10 * -|^^^^^^^^^^^^^^^ markup.raw.code-fence.sql -|^^^^^^^^^ keyword.other.DML.sql +|^^^^^^^^^^^^^^^ markup.raw.code-fence.sql source.sql FROM TableName ``` |^^ meta.code-fence.definition.end.sql punctuation.definition.raw.code-fence.end - markup From b292205ca3a0fdbc32eaf3b335860c7020ea049a Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Wed, 17 Nov 2021 17:44:16 +0100 Subject: [PATCH 27/56] Syntax: Refactor main comment --- syntaxes/Markdown.sublime-syntax | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/syntaxes/Markdown.sublime-syntax b/syntaxes/Markdown.sublime-syntax index 00ac62c5..449753bf 100644 --- a/syntaxes/Markdown.sublime-syntax +++ b/syntaxes/Markdown.sublime-syntax @@ -1,18 +1,23 @@ %YAML 1.2 --- -# http://www.sublimetext.com/docs/3/syntax.html +# This definition aims to meet CommonMark specifications +# http://spec.commonmark.org/ +# with GitHub Formatted Markdown extensions +# https://github.github.com/gfm/ +# and has a few extras like Markdown Extra's footnotes +# https://michelf.ca/projects/php-markdown/extra/#footnotes +# +# The scope suffix should indicate which flavor of Markdown the feature came from, +# to help make this syntax definition easier to maintain. name: Markdown +scope: text.html.markdown + file_extensions: - md - mdown - markdown - markdn -scope: text.html.markdown -comment: |- - this definition aims to meet CommonMark specifications http://spec.commonmark.org/ - with GitHub Formatted Markdown extensions https://github.github.com/gfm/ - and has a few extras like Markdown Extra's footnotes https://michelf.ca/projects/php-markdown/extra/#footnotes - the scope suffix should indicate which flavor of Markdown the feature came from, to help make this syntax definition easier to maintain + variables: thematic_break: |- (?x: From adde2616f81cd69ad0add1ed528d8e9b4c053899 Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Fri, 19 Nov 2021 18:15:17 +0100 Subject: [PATCH 28/56] Fix: Use better table border color of Mariana color scheme --- messages/3.1.0.md | 1 + schemes/Mariana.sublime-color-scheme | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/messages/3.1.0.md b/messages/3.1.0.md index 98a695ea..c5cb4857 100644 --- a/messages/3.1.0.md +++ b/messages/3.1.0.md @@ -7,6 +7,7 @@ feedback you can use [GitHub issues][issues]. * Silently fail with empty wiki page links * Display correct key for `MarkdownEditing: Decrease Heading Level` in Command Palette +* Use better table border color of Mariana color scheme ## New Features diff --git a/schemes/Mariana.sublime-color-scheme b/schemes/Mariana.sublime-color-scheme index c73771db..d5f65a2a 100644 --- a/schemes/Mariana.sublime-color-scheme +++ b/schemes/Mariana.sublime-color-scheme @@ -128,7 +128,7 @@ { "name": "Table Separators / Lines", "scope": "text.html.markdown meta.table.header-separator punctuation.section, text.html.markdown punctuation.section.table-header, text.html.markdown punctuation.separator.table-cell", - "foreground": "var(grey)" + "foreground": "var(blue4)" }, { "name": "Table Cell Content Alignment Operator", From aab371999a2e83c81627053db05e5f9b55aed173 Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Sat, 20 Nov 2021 14:34:16 +0100 Subject: [PATCH 29/56] Syntax: Refactor html blocks --- syntaxes/Markdown.sublime-syntax | 151 ++++++++++++++++++------------- tests/syntax_test_markdown.md | 5 + 2 files changed, 95 insertions(+), 61 deletions(-) diff --git a/syntaxes/Markdown.sublime-syntax b/syntaxes/Markdown.sublime-syntax index 449753bf..36b4e244 100644 --- a/syntaxes/Markdown.sublime-syntax +++ b/syntaxes/Markdown.sublime-syntax @@ -148,7 +148,12 @@ variables: email_domain_commonmark: '[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?' email_user_commonmark: '[a-zA-Z0-9.!#$%&''*+/=?^_`{|}~-]+' - html_tag_open_commonmark: |- + # https://spec.commonmark.org/0.30/#html-blocks + html_block_comment: <---> - # <= <== <=== <=> <==> <===> - - match: '>(-+|=+)[<>]?' # >- >-- >--- >-> >--> >---> >-< >--< >---< - # >= >== >=== >=> >==> >===> >=< >==< >===< - - match: '<<+|<>|>>+' # << <<< <<<< <> >>>> >>> >> - hard-line-breaks: - match: '[ ]{2,}$' scope: meta.hard-line-break.markdown punctuation.definition.hard-line-break.markdown diff --git a/tests/syntax_test_markdown.md b/tests/syntax_test_markdown.md index 218cfc5e..985e52c7 100644 --- a/tests/syntax_test_markdown.md +++ b/tests/syntax_test_markdown.md @@ -1032,12 +1032,10 @@ a.b-c_d@a.b. ###[ LIGATURES ]############################################################## this is a raw ampersand & does not require HTML escaping -| ^ meta.other.valid-ampersand +| ^ - entity - illegal this is a raw bracket < > does not require HTML escaping -| ^^^ - meta.tag -| ^ meta.other.valid-bracket -| ^ - meta.other.valid-bracket +| ^^^ - meta.tag - punctuation these are raw ligatures << <<< <<<< <<<<< >>>>> >>>> >>> >> | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.other.valid-bracket - meta.tag From 6cb061b2a308bdbbd13dd38929df427754719415 Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Sun, 21 Nov 2021 12:00:56 +0100 Subject: [PATCH 32/56] Syntax: Use common leading space pattern style --- syntaxes/Markdown.sublime-syntax | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/syntaxes/Markdown.sublime-syntax b/syntaxes/Markdown.sublime-syntax index b953f7ff..ce863c4b 100644 --- a/syntaxes/Markdown.sublime-syntax +++ b/syntaxes/Markdown.sublime-syntax @@ -389,7 +389,7 @@ contexts: ###[ CONTAINER BLOCKS: LISTS ]################################################ list-blocks: - - match: ^([ ]{0,3})([*+-])( (\[)([ xX])(\]))?(?=\s) + - match: ^([ ]{,3})([*+-])( (\[)([ xX])(\]))?(?=\s) captures: 1: markup.list.unnumbered.markdown 2: markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown @@ -398,7 +398,7 @@ contexts: 5: markup.checkbox.mark.markdown-gfm 6: markup.checkbox.end.markdown-gfm punctuation.definition.checkbox.end.markdown-gfm push: unordered-list-paragraph - - match: ^([ ]{0,3})(\d+([.)]))(?=\s) + - match: ^([ ]{,3})(\d+([.)]))(?=\s) captures: 1: markup.list.numbered.markdown 2: markup.list.numbered.bullet.markdown @@ -1923,7 +1923,7 @@ contexts: footnote-definitions: # Mardown Extras Footnotes - - match: '[ ]{0,3}(\[)({{footnote_name}})(\])(:)' + - match: '[ ]{,3}(\[)({{footnote_name}})(\])(:)' captures: 1: punctuation.definition.reference.begin.markdown 2: entity.name.reference.link.markdown @@ -1942,7 +1942,7 @@ contexts: link-definitions: # https://spec.commonmark.org/0.30/#link-reference-definition - - match: '[ ]{0,3}(\[)({{reference_name}})(\])(:)' + - match: '[ ]{,3}(\[)({{reference_name}})(\])(:)' captures: 1: punctuation.definition.reference.begin.markdown 2: entity.name.reference.link.markdown From 62163306320f540d39c9bcd8819481b2eeb6cce2 Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Wed, 24 Nov 2021 18:15:41 +0100 Subject: [PATCH 33/56] Syntax: Refactor list blocks --- syntaxes/Markdown.sublime-syntax | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/syntaxes/Markdown.sublime-syntax b/syntaxes/Markdown.sublime-syntax index ce863c4b..2402ebba 100644 --- a/syntaxes/Markdown.sublime-syntax +++ b/syntaxes/Markdown.sublime-syntax @@ -272,7 +272,7 @@ contexts: block-quotes: # https://spec.commonmark.org/0.30/#block-quotes - - match: ^{{block_quote}} + - match: '{{block_quote}}' comment: |- We terminate the block quote when seeing an empty line, a separator or a line with leading > characters. The latter is @@ -407,41 +407,32 @@ contexts: unordered-list-paragraph: - meta_content_scope: markup.list.unnumbered.markdown - - match: ^(?=\S) - pop: true - include: list-paragraph ordered-list-paragraph: - meta_content_scope: markup.list.numbered.markdown - - match: ^(?=\S) - pop: true - include: list-paragraph list-paragraph: + - match: ^(?=\S|{{atx_heading}}) + pop: true - include: list-indended-code-blocks - - include: list-block-quotes + - include: block-quotes - include: fenced-code-blocks - - include: reference-definitions - include: html-blocks - include: latex-blocks + - include: reference-definitions + - include: thematic-breaks - match: (?=\S) push: list-items - list-block-quotes: - - match: ^[ ]*{{block_quote}} - captures: - 1: punctuation.definition.blockquote.markdown - push: - - block-quote-meta - - block-quote-content - list-indended-code-blocks: # at least 8 chars / 2 tabs - match: ^{{indented_code_block}}{2,}[^>+*\s-].*$\n? scope: markup.raw.block.markdown list-items: - - match: ^\s*$ + - match: ^(?=\s*$|{{atx_heading}}) pop: true - match: ([ ]*)([*+-])((?:[ ](\[)([ xX])(\]))?\s) captures: @@ -460,8 +451,6 @@ contexts: push: ordered-list-content - match: \s+ scope: meta.paragraph.list.markdown - - match: (?=^{{atx_heading}}) - pop: true - match: (?=\S) push: list-content @@ -477,8 +466,11 @@ contexts: list-content: - meta_content_scope: meta.paragraph.list.markdown - - include: latex-blocks + - include: list-block-quotes - include: fenced-code-blocks + - include: html-blocks + - include: latex-blocks + - include: reference-definitions - include: thematic-breaks - match: ^ pop: true From 7c4758f951f48e0477080b68e8de3f8d291b9cbb Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Wed, 1 Dec 2021 19:12:05 +0100 Subject: [PATCH 34/56] Docs: Fix color scheme links Fixes #666 --- docs/config.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/config.md b/docs/config.md index 4a2736ca..be357bc8 100644 --- a/docs/config.md +++ b/docs/config.md @@ -36,8 +36,8 @@ You can use your global color scheme or one of those shipped with MarkdownEditin #### Additional Color Schemes: -- [Blackboard theme](linkBlackboardTheme) by [@mdesantis](https://github.com/mdesantis) -- [monokaiC](https://github.com/avivace/monokaiC) by [@avivace](https://github.com/avivace) +- [Blackboard theme](https://github.com/mdesantis/MarkdownEditing/blob/blackboard-theme/MarkdownEditor-Blackboard.tmTheme) by [@mdesantis](https://github.com/mdesantis) +- [monokaiC](https://github.com/avivace/MonokaiC/blob/master/themes/ME-MonokaiC.tmTheme) by [@avivace](https://github.com/avivace) !!!note "Custom Color Schemes" MarkdownEditing lists all color schemes named like `MarkdownEditor-.sublime-color-scheme`, no matter which package they are placed in. From 670c43ce11af071064e3cb0640774a5b29dfacdf Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Wed, 1 Dec 2021 20:43:20 +0100 Subject: [PATCH 35/56] Fix: List MarkdownEditor-*.tmTheme color schemes With this commit MarkdownEditing also lists old *.tmTheme color schemes in the "MarkdownEditing: Select Color Scheme" quick panel. --- messages/3.1.0.md | 1 + plugins/color_schemes.py | 15 +++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/messages/3.1.0.md b/messages/3.1.0.md index c5cb4857..5908aa38 100644 --- a/messages/3.1.0.md +++ b/messages/3.1.0.md @@ -8,6 +8,7 @@ feedback you can use [GitHub issues][issues]. * Silently fail with empty wiki page links * Display correct key for `MarkdownEditing: Decrease Heading Level` in Command Palette * Use better table border color of Mariana color scheme +* List MarkdownEditor-\*.tmTheme color schemes (see #666) ## New Features diff --git a/plugins/color_schemes.py b/plugins/color_schemes.py index 62fd5264..2cc2aa74 100644 --- a/plugins/color_schemes.py +++ b/plugins/color_schemes.py @@ -35,9 +35,11 @@ def select_color_scheme(view=None): global_scheme = global_settings.get("color_scheme") schemes = [global_scheme, "MarkdownEditor.sublime-color-scheme"] for scheme in sublime.find_resources("MarkdownEditor*.sublime-color-scheme"): - file_name = scheme.split("/")[-1] - if file_name not in schemes: - schemes.append(file_name) + if scheme not in schemes: + schemes.append(scheme) + for scheme in sublime.find_resources("MarkdownEditor*.tmTheme"): + if scheme not in schemes: + schemes.append(scheme) schemes_display = [] selected_index = 0 @@ -59,6 +61,8 @@ def select_color_scheme(view=None): def set_scheme(scheme): if scheme: + if scheme.endswith(".sublime-color-scheme"): + scheme = scheme.split("/")[-1] md_settings.set("color_scheme", scheme) else: md_settings.erase("color_scheme") @@ -77,7 +81,10 @@ def on_done(index): pre_view.close() def on_highlighted(index): - pre_view.settings().set("color_scheme", schemes[index]) + scheme = schemes[index] + if scheme.endswith(".sublime-color-scheme"): + scheme = scheme.split("/")[-1] + pre_view.settings().set("color_scheme", scheme) window.show_quick_panel( schemes_display, From 836e3f63d681cf9a80777dea4c948da21b999b3b Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Thu, 2 Dec 2021 18:39:56 +0100 Subject: [PATCH 36/56] Syntax: Fix paragraph/link highlighting after tables This commit fixes syntax highlighting of lines directly followed by header tables in an ST3 compatible way. Note: This syntax parses a line as table header if it contains a pipe `|`. The following line must consist of a sequence of `-`, `:` and `|` only for the block to be a valid markdown table. For compatibility reasons the first line keeps scoped as table header at this point, which is not very correct. The table contexts are just popped off stack if second line doesn't look like a table separator. A future ST4 only change might use branching to prevent the first line from being scoped as table header. --- syntaxes/Markdown.sublime-syntax | 9 +++++++-- tests/syntax_test_markdown.md | 14 ++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/syntaxes/Markdown.sublime-syntax b/syntaxes/Markdown.sublime-syntax index 2402ebba..f5c10300 100644 --- a/syntaxes/Markdown.sublime-syntax +++ b/syntaxes/Markdown.sublime-syntax @@ -1986,9 +1986,15 @@ contexts: table-header: - meta_content_scope: meta.table.header.markdown-gfm - match: \n - set: table-header-separator + set: table-header-separator-begin - include: table-cell-content + table-header-separator-begin: + - match: ^(?=[-|:\s]+$) + set: table-header-separator + - match: ^ + pop: true + table-header-separator: - meta_content_scope: meta.table.header-separator.markdown-gfm - match: \n @@ -1998,7 +2004,6 @@ contexts: - match: ':' scope: punctuation.definition.table-cell-alignment.markdown - include: table-cell-separators - - include: table-end table-body: - meta_content_scope: meta.table.markdown-gfm diff --git a/tests/syntax_test_markdown.md b/tests/syntax_test_markdown.md index 985e52c7..2b90f714 100644 --- a/tests/syntax_test_markdown.md +++ b/tests/syntax_test_markdown.md @@ -2446,6 +2446,8 @@ abc | ^ punctuation.separator.table-cell | ^ punctuation.separator.table-cell | ^^^^ - punctuation.separator.table-cell + +| foo | bar | | --- | --- | | baz | bim Ctrl+C | | <- meta.table punctuation.separator.table-cell @@ -2469,6 +2471,8 @@ bar | baz | <- meta.table punctuation.separator.table-cell | ^^ meta.table constant.character.escape - punctuation.separator.table-cell | ^ meta.table punctuation.separator.table-cell + +| f\|oo | | ------ | | b `|` az | | ^^^ meta.table markup.raw.inline - meta.table.header-separator @@ -2544,6 +2548,16 @@ not a table | |^ invalid.deprecated.unescaped-backticks | ^ punctuation.separator.table-cell +| table | followed by +paragraph +| <- meta.paragraph.markdown +|^^^^^^^^^ meta.paragraph.markdown + +| table | followed by +https://foo.bar/baz +| <- meta.paragraph.markdown meta.link.inet.markdown markup.underline.link.markdown-gfm +|^^^^^^^^^^^^^^^^^^ meta.paragraph.markdown meta.link.inet.markdown markup.underline.link.markdown-gfm + | table | followed by # heading | <- markup.heading.1.markdown punctuation.definition.heading.begin.markdown From 7d8d8c01819713e8a5014e8d8a5531c4fc224b39 Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Fri, 3 Dec 2021 18:35:04 +0100 Subject: [PATCH 37/56] Syntax: Remove string scopes from link/image/ref titles --- plugins/references.py | 2 +- syntaxes/Markdown.sublime-syntax | 10 ++-------- tests/syntax_test_markdown.md | 9 ++------- 3 files changed, 5 insertions(+), 16 deletions(-) diff --git a/plugins/references.py b/plugins/references.py index 2749b75a..b89ea3a0 100644 --- a/plugins/references.py +++ b/plugins/references.py @@ -33,7 +33,7 @@ ref_link_scope_name = "markup.underline.link.markdown" marker_begin_scope_name = "punctuation.definition.link.begin.markdown" marker_text_end_scope_name = "punctuation.definition.link.end.markdown" -marker_text_scope_name = "string.other.link.title.markdown" +marker_text_scope_name = "meta.image.inline.description.markdown, meta.image.reference.description.markdown, meta.link.inline.description.markdown, meta.link.reference.description.markdown, meta.link.reference.literal.description.markdown" refname_start_scope_name = "punctuation.definition.metadata.begin.markdown" marker_end_scope_name = "punctuation.definition.metadata.end.markdown" diff --git a/syntaxes/Markdown.sublime-syntax b/syntaxes/Markdown.sublime-syntax index f5c10300..19e27060 100644 --- a/syntaxes/Markdown.sublime-syntax +++ b/syntaxes/Markdown.sublime-syntax @@ -2347,7 +2347,6 @@ contexts: image-inline-text: - meta_scope: meta.image.inline.description.markdown - - meta_content_scope: string.other.link.title.markdown - match: \] scope: punctuation.definition.image.end.markdown pop: true @@ -2404,7 +2403,6 @@ contexts: image-ref-text: - meta_scope: meta.image.reference.description.markdown - - meta_content_scope: string.other.link.title.markdown - match: \] scope: punctuation.definition.image.end.markdown pop: true @@ -2415,7 +2413,7 @@ contexts: scope: meta.image.reference.metadata.markdown captures: 1: punctuation.definition.metadata.begin.markdown - 2: constant.other.reference.link.markdown + 2: markup.underline.link.markdown 3: punctuation.definition.metadata.end.markdown pop: true - include: immediately-pop @@ -2441,7 +2439,6 @@ contexts: link-inline-text: - meta_scope: meta.link.inline.description.markdown - - meta_content_scope: string.other.link.title.markdown - match: \] scope: punctuation.definition.link.end.markdown pop: true @@ -2501,7 +2498,6 @@ contexts: link-ref-link-text: - meta_scope: meta.link.reference.description.markdown - - meta_content_scope: string.other.link.title.markdown - match: \] scope: punctuation.definition.link.end.markdown pop: true @@ -2512,7 +2508,7 @@ contexts: scope: meta.link.reference.metadata.markdown captures: 1: punctuation.definition.metadata.begin.markdown - 2: constant.other.reference.link.markdown + 2: markup.underline.link.markdown 3: punctuation.definition.metadata.end.markdown pop: true - include: immediately-pop @@ -2537,7 +2533,6 @@ contexts: link-ref-literal-link-text: - meta_scope: meta.link.reference.literal.description.markdown - - meta_content_scope: string.other.link.title.markdown - match: \] scope: punctuation.definition.link.end.markdown pop: true @@ -2577,7 +2572,6 @@ contexts: link-ref-wiki-link-text: - meta_scope: meta.link.reference.wiki.description.markdown - - meta_content_scope: string.other.link.title.markdown - match: \]\] scope: punctuation.definition.link.end.markdown pop: true diff --git a/tests/syntax_test_markdown.md b/tests/syntax_test_markdown.md index 2b90f714..fbb61cbb 100644 --- a/tests/syntax_test_markdown.md +++ b/tests/syntax_test_markdown.md @@ -265,7 +265,6 @@ Here is a [reference link][name]. | ^^^^^^^^^^^^^^^^ meta.link.reference.description.markdown | ^^^^^^ meta.link.reference.metadata.markdown | ^ punctuation.definition.link.begin.markdown -| ^^^^^^^^^^^^^^ string.other.link.title.markdown | ^ punctuation.definition.link.end.markdown | ^ punctuation.definition.metadata.begin.markdown | ^^^^ constant.other.reference.link.markdown @@ -279,7 +278,6 @@ Here is a [reference link][name]{_attr='value' :att2}. | ^ - meta.attribute-with-value | ^^^^^ meta.attribute-with-value.markdown | ^ punctuation.definition.link.begin.markdown -| ^^^^^^^^^^^^^^ string.other.link.title.markdown | ^ punctuation.definition.link.end.markdown | ^ punctuation.definition.metadata.begin.markdown | ^^^^ constant.other.reference.link.markdown @@ -296,7 +294,6 @@ Here is a [blank reference link][]{}. | ^^ meta.link.reference.literal.metadata.markdown | ^^ meta.link.reference.literal.attributes.markdown | ^ punctuation.definition.link.begin.markdown -| ^^^^^^^^^^^^^^^^^^^^ string.other.link.title.markdown | ^ punctuation.definition.link.end.markdown | ^ punctuation.definition.metadata.begin.markdown | ^ punctuation.definition.metadata.end.markdown @@ -414,7 +411,6 @@ Here is a ![Image Ref Alt][1]. | ^^^^^^^^^^^^^^^^ meta.image.reference.description.markdown | ^^^ meta.image.reference.metadata.markdown | ^^ punctuation.definition.image.begin.markdown -| ^^^^^^^^^^^^^ string.other.link.title.markdown | ^ punctuation.definition.image.end.markdown | ^ punctuation.definition.metadata.begin.markdown | ^ constant.other.reference.link.markdown @@ -3093,8 +3089,8 @@ link with a single underscore inside the text : [@_test](http://example.com) This is literal [Foo*bar\]] but [ref][Foo*bar\]] | ^^^^^^^^^^^ meta.link.reference.description.markdown | ^ punctuation.definition.link.begin.markdown -| ^^^^^^^ string.other.link.title.markdown - constant -| ^^ string.other.link.title.markdown constant.character.escape.markdown +| ^^^^^^^ - constant +| ^^ constant.character.escape.markdown | ^ punctuation.definition.link.end.markdown | ^^^^^ meta.link.reference.description.markdown | ^^^^^^^^^^^ meta.link.reference.metadata.markdown @@ -3200,5 +3196,4 @@ This is an {== information ==}{>> comment <<}. This is a [[wiki link]]. | ^^^^^^^^^^^^^ meta.link.reference.wiki.description.markdown | ^^ punctuation.definition.link.begin.markdown -| ^^^^^^^^^ string.other.link.title.markdown | ^^ punctuation.definition.link.end.markdown From 5a8a06249cf4e223aa6ca0f8d25ac625eab1965f Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Fri, 3 Dec 2021 18:44:42 +0100 Subject: [PATCH 38/56] Syntax: Use markup.underline.link for references --- plugins/references.py | 2 +- tests/syntax_test_markdown.md | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/plugins/references.py b/plugins/references.py index b89ea3a0..76b87ba8 100644 --- a/plugins/references.py +++ b/plugins/references.py @@ -29,7 +29,7 @@ marker_scope_name = "meta.link.reference.description.markdown" marker_literal_scope_name = "meta.link.reference.literal.description.markdown" marker_image_scope_name = "meta.image.reference.description.markdown" -marker_ref_scope_name = "constant.other.reference.link.markdown" +marker_ref_scope_name = "markup.underline.link.markdown" ref_link_scope_name = "markup.underline.link.markdown" marker_begin_scope_name = "punctuation.definition.link.begin.markdown" marker_text_end_scope_name = "punctuation.definition.link.end.markdown" diff --git a/tests/syntax_test_markdown.md b/tests/syntax_test_markdown.md index fbb61cbb..25520a36 100644 --- a/tests/syntax_test_markdown.md +++ b/tests/syntax_test_markdown.md @@ -267,7 +267,7 @@ Here is a [reference link][name]. | ^ punctuation.definition.link.begin.markdown | ^ punctuation.definition.link.end.markdown | ^ punctuation.definition.metadata.begin.markdown -| ^^^^ constant.other.reference.link.markdown +| ^^^^ markup.underline.link.markdown | ^ punctuation.definition.metadata.end.markdown Here is a [reference link][name]{_attr='value' :att2}. @@ -280,7 +280,7 @@ Here is a [reference link][name]{_attr='value' :att2}. | ^ punctuation.definition.link.begin.markdown | ^ punctuation.definition.link.end.markdown | ^ punctuation.definition.metadata.begin.markdown -| ^^^^ constant.other.reference.link.markdown +| ^^^^ markup.underline.link.markdown | ^ punctuation.definition.metadata.end.markdown | ^ punctuation.definition.attributes.begin.markdown | ^^^^^ entity.other.attribute-name.markdown @@ -413,7 +413,7 @@ Here is a ![Image Ref Alt][1]. | ^^ punctuation.definition.image.begin.markdown | ^ punctuation.definition.image.end.markdown | ^ punctuation.definition.metadata.begin.markdown -| ^ constant.other.reference.link.markdown +| ^ markup.underline.link.markdown | ^ punctuation.definition.metadata.end.markdown now you can access the [The Ever Cool Site: Documentation about Sites]( @@ -2304,23 +2304,23 @@ _foo [**bar**](/url)_ |^^ punctuation.definition.bold.begin | ^^^^^^^ constant.character.entity.decimal.html | ^^ punctuation.definition.bold.end -| ^^^^^^^ constant.other.reference.link +| ^^^^^^^ markup.underline.link [Read more →][details] | ^^^^^^^ constant.character.entity.decimal.html -| ^^^^^^^ constant.other.reference.link +| ^^^^^^^ markup.underline.link [Read more ][details] |^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.link.reference.description | ^^^^^^^^^^^^^^^^^^ source.css | ^^^^^^^ constant.character.entity.decimal.html -| ^^^^^^^ constant.other.reference.link +| ^^^^^^^ markup.underline.link [![Cool ★ Image - Click to Enlarge][img-example]][img-example] |^ punctuation.definition.image.begin -| ^^^^^^^^^^^ constant.other.reference.link +| ^^^^^^^^^^^ markup.underline.link | ^ punctuation.definition.link.end -| ^^^^^^^^^^^ constant.other.reference.link +| ^^^^^^^^^^^ markup.underline.link [![Cool ★ Image - Click to Enlarge](http://www.sublimetext.com/anim/rename2_packed.png)](http://www.sublimetext.com/anim/rename2_packed.png) |^ punctuation.definition.image.begin From fdeadb84afe266a05a14ffb6869dd57f74bfb830 Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Fri, 3 Dec 2021 20:35:54 +0100 Subject: [PATCH 39/56] Syntax: Rename link title scopes --- syntaxes/Markdown.sublime-syntax | 6 +++--- tests/syntax_test_markdown.md | 28 ++++++++++++++-------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/syntaxes/Markdown.sublime-syntax b/syntaxes/Markdown.sublime-syntax index 19e27060..f546cf73 100644 --- a/syntaxes/Markdown.sublime-syntax +++ b/syntaxes/Markdown.sublime-syntax @@ -2611,21 +2611,21 @@ contexts: pop: true link-title-double-quoted-content: - - meta_scope: string.other.link.description.title.markdown + - meta_scope: meta.string.title.markdown string.quoted.double.markdown - match: \" scope: punctuation.definition.string.end.markdown pop: true - include: link-title-common link-title-single-quoted-content: - - meta_scope: string.other.link.description.title.markdown + - meta_scope: meta.string.title.markdown string.quoted.single.markdown - match: \' scope: punctuation.definition.string.end.markdown pop: true - include: link-title-common link-title-other-quoted-content: - - meta_scope: string.other.link.description.title.markdown + - meta_scope: meta.string.title.markdown string.quoted.other.markdown - match: \) scope: punctuation.definition.string.end.markdown pop: true diff --git a/tests/syntax_test_markdown.md b/tests/syntax_test_markdown.md index 25520a36..15da96a2 100644 --- a/tests/syntax_test_markdown.md +++ b/tests/syntax_test_markdown.md @@ -372,7 +372,7 @@ Here is a ![Image Alt Text]( Here is a ![Image Alt Text]( https://example.com/cat.gif "hello" ). -|^^^^^^^ meta.image.inline string.other.link.description.title +|^^^^^^^ meta.image.inline string.quoted.double | ^^^^ meta.image.inline | ^ punctuation.definition.metadata.end @@ -383,7 +383,7 @@ Here is a ![Image Alt Text]( | ^ punctuation.definition.link.begin.markdown | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.image.markdown | ^ punctuation.definition.link.end.markdown -| ^^^^^^^ string.other.link.description.title.markdown +| ^^^^^^^ string.quoted.double.markdown | ^ punctuation.definition.string.begin.markdown | ^ punctuation.definition.string.end.markdown | ^ punctuation.definition.metadata.end.markdown @@ -395,7 +395,7 @@ Here is a ![Image Alt Text]( | ^ punctuation.definition.link.begin.markdown | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.image.markdown | ^ punctuation.definition.link.end.markdown -| ^^^^^^^ string.other.link.description.title.markdown +| ^^^^^^^ string.quoted.other.markdown | ^ punctuation.definition.string.begin.markdown | ^ punctuation.definition.string.end.markdown | ^ punctuation.definition.metadata.end.markdown @@ -433,7 +433,7 @@ now you can access the [The Ever Cool Site: Documentation about Sites]( (title)) for more information about... | ^^^^^^^^ meta.paragraph meta.link.inline | ^ punctuation.definition.metadata.end -| ^^^^^^^ string.other.link.description.title.markdown +| ^^^^^^^ string.quoted.other.markdown 1. Ordered list item | ^^^^^^^^^^^^^^^^^^^^^ markup.list.numbered @@ -1069,7 +1069,7 @@ these are raw ligatures - -- --- ---- ----- ===== ==== === == = |^ entity.name.reference.link | ^ punctuation.separator.key-value | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link -| ^^^^^^^^^^^^^^^ string.other.link.description.title +| ^^^^^^^^^^^^^^^ string.quoted.double | ^ punctuation.definition.string.begin | ^ punctuation.definition.string.end @@ -1079,7 +1079,7 @@ these are raw ligatures - -- --- ---- ----- ===== ==== === == = |^ entity.name.reference.link | ^ punctuation.separator.key-value | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link -| ^^^^^^^^^^^^^^^^^^^^^^^^^ string.other.link.description.title +| ^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.single | ^ punctuation.definition.string.begin | ^ punctuation.definition.string.end @@ -1247,7 +1247,7 @@ because it doesn't begin with the number one: | ^ punctuation.definition.image.end | ^ punctuation.definition.metadata | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.image.markdown -| ^^^^^^^^^^^^^^^^^ string.other.link.description.title +| ^^^^^^^^^^^^^^^^^ string.quoted.double | ^ punctuation.definition.string.begin | ^ punctuation.definition.string.end | ^ punctuation.definition.metadata @@ -1258,7 +1258,7 @@ because it doesn't begin with the number one: | ^ punctuation.definition.image.end | ^ punctuation.definition.metadata | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.image.markdown -| ^^^^^^^^^^^^^^^^^ string.other.link.description.title +| ^^^^^^^^^^^^^^^^^ string.quoted.single | ^ punctuation.definition.string.begin | ^ punctuation.definition.string.end | ^ punctuation.definition.metadata @@ -1269,7 +1269,7 @@ because it doesn't begin with the number one: | ^ punctuation.definition.image.end | ^ punctuation.definition.metadata | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.underline.link.image.markdown -| ^^^^^^^^^^^^^^^^^ string.other.link.description.title +| ^^^^^^^^^^^^^^^^^ string.quoted.other | ^ punctuation.definition.string.begin | ^ punctuation.definition.string.end | ^ punctuation.definition.metadata @@ -2339,7 +2339,7 @@ _foo [**bar**](/url)_ [//]: # (This is a comment without a line-break.) | ^ meta.link.reference.def.markdown markup.underline.link -| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.other.link.description.title +| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.other | ^ - meta.link [//]: # (This is a comment with a @@ -2358,7 +2358,7 @@ _foo [**bar**](/url)_ [//]: # (testing blah -| <- meta.link.reference.def.markdown string.other.link.description.title +| <- meta.link.reference.def.markdown string.quoted.other | <- invalid.illegal.non-terminated.link-title text @@ -2370,7 +2370,7 @@ text | ^ punctuation.definition.link.begin | ^^^ markup.underline.link | ^ punctuation.definition.link.end -| ^^^^^^ string.other.link.description.title +| ^^^^^^ string.quoted.double | ^ - invalid.illegal.expected-eol [foo]: > "test" @@ -3079,7 +3079,7 @@ link with a single underscore inside the text : [@_test](http://example.com) |^^^^^^^^^^^^^^^^^^ meta.link.reference.def.markdown | ^ punctuation.separator.key-value | ^^^^ markup.underline.link -| ^^^^^^^ string.other.link.description.title +| ^^^^^^^ string.quoted.double [foo] |<- meta.link.reference punctuation.definition.link.begin @@ -3103,7 +3103,7 @@ This is literal [Foo*bar\]] but [ref][Foo*bar\]] | ^ punctuation.separator.key-value.markdown | ^^^^^^^^ markup.underline.link | ^ - markup - string -| ^^^^^^^^^^^^^^^^^^^^^ string.other.link.description.title +| ^^^^^^^^^^^^^^^^^^^^^ string.quoted.single [foo]: <> |^^^^^^^^^ meta.link.reference.def.markdown From b0ca892f8cabc3becab2c7d648790266c9af79bf Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Mon, 6 Dec 2021 18:15:56 +0100 Subject: [PATCH 40/56] Syntax: Add css support in fenced code blocks --- syntaxes/Markdown.sublime-syntax | 18 ++++++++++++++++++ tests/syntax_test_markdown.md | 5 +++++ 2 files changed, 23 insertions(+) diff --git a/syntaxes/Markdown.sublime-syntax b/syntaxes/Markdown.sublime-syntax index f546cf73..e2a179e5 100644 --- a/syntaxes/Markdown.sublime-syntax +++ b/syntaxes/Markdown.sublime-syntax @@ -644,6 +644,7 @@ contexts: - include: fenced-c - include: fenced-cpp - include: fenced-csharp + - include: fenced-css - include: fenced-diff - include: fenced-erlang - include: fenced-graphviz @@ -773,6 +774,23 @@ contexts: 0: meta.code-fence.definition.end.csharp.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown + fenced-css: + - match: |- + (?x) + {{fenced_code_block_start}} + ((?i:css)) + {{fenced_code_block_trailing_infostring_characters}} + captures: + 0: meta.code-fence.definition.begin.css.markdown-gfm + 2: punctuation.definition.raw.code-fence.begin.markdown + 5: constant.other.language-name.markdown + embed: scope:source.css + embed_scope: markup.raw.code-fence.css.markdown-gfm + escape: '{{code_fence_escape}}' + escape_captures: + 0: meta.code-fence.definition.end.css.markdown-gfm + 1: punctuation.definition.raw.code-fence.end.markdown + fenced-diff: - match: |- (?x) diff --git a/tests/syntax_test_markdown.md b/tests/syntax_test_markdown.md index 15da96a2..8a5d5406 100644 --- a/tests/syntax_test_markdown.md +++ b/tests/syntax_test_markdown.md @@ -2867,6 +2867,11 @@ okay ``` |^^ meta.code-fence.definition.end.clojure punctuation.definition.raw.code-fence.end +```css + +| <- markup.raw.code-fence.css.markdown-gfm source.css +``` + ```diff + inserted | <- source.diff markup.inserted.diff punctuation.definition.inserted.diff From cee83fc06998cf214ecf0855f95ed01cf77b6a62 Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Mon, 6 Dec 2021 18:28:54 +0100 Subject: [PATCH 41/56] Syntax: Move fenced dosbatch context Dosbatch is a default syntax supported by ST, thus moving it to internal syntaxes. --- syntaxes/Markdown.sublime-syntax | 36 ++++++++++++++++---------------- tests/syntax_test_markdown.md | 5 +++++ 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/syntaxes/Markdown.sublime-syntax b/syntaxes/Markdown.sublime-syntax index e2a179e5..0a2fadfa 100644 --- a/syntaxes/Markdown.sublime-syntax +++ b/syntaxes/Markdown.sublime-syntax @@ -646,6 +646,7 @@ contexts: - include: fenced-csharp - include: fenced-css - include: fenced-diff + - include: fenced-dosbatch - include: fenced-erlang - include: fenced-graphviz - include: fenced-golang @@ -683,7 +684,6 @@ contexts: - include: fenced-coffee - include: fenced-dart - include: fenced-docker - - include: fenced-dosbatch - include: fenced-elixir - include: fenced-fish - include: fenced-graphql @@ -808,6 +808,23 @@ contexts: 0: meta.code-fence.definition.end.diff.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown + fenced-dosbatch: + - match: |- + (?x) + {{fenced_code_block_start}} + ((?i:bat|cmd|dos)) + {{fenced_code_block_trailing_infostring_characters}} + captures: + 0: meta.code-fence.definition.begin.dosbatch.markdown-gfm + 2: punctuation.definition.raw.code-fence.begin.markdown + 5: constant.other.language-name.markdown + embed: scope:source.dosbatch + embed_scope: markup.raw.code-fence.dosbatch.markdown-gfm + escape: '{{code_fence_escape}}' + escape_captures: + 0: meta.code-fence.definition.end.dosbatch.markdown-gfm + 1: punctuation.definition.raw.code-fence.end.markdown + fenced-erlang: - match: |- (?x) @@ -1389,23 +1406,6 @@ contexts: 0: meta.code-fence.definition.end.akh.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown - fenced-dosbatch: - - match: |- - (?x) - {{fenced_code_block_start}} - ((?i:bat|batch|cmd|dosbatch)) - {{fenced_code_block_trailing_infostring_characters}} - captures: - 0: meta.code-fence.definition.begin.dosbatch.markdown-gfm - 2: punctuation.definition.raw.code-fence.begin.markdown - 5: constant.other.language-name.markdown - embed: scope:source.dosbatch - embed_scope: markup.raw.code-fence.dosbatch.markdown-gfm - escape: '{{code_fence_escape}}' - escape_captures: - 0: meta.code-fence.definition.end.dosbatch.markdown-gfm - 1: punctuation.definition.raw.code-fence.end.markdown - fenced-coffee: - match: |- (?x) diff --git a/tests/syntax_test_markdown.md b/tests/syntax_test_markdown.md index 8a5d5406..c4d56a19 100644 --- a/tests/syntax_test_markdown.md +++ b/tests/syntax_test_markdown.md @@ -2867,6 +2867,11 @@ okay ``` |^^ meta.code-fence.definition.end.clojure punctuation.definition.raw.code-fence.end +```cmd + +| <- markup.raw.code-fence.dosbatch.markdown-gfm source.dosbatch +``` + ```css | <- markup.raw.code-fence.css.markdown-gfm source.css From f3ceb00049e14d7b9f9b56298ede5746ad56bd0c Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Mon, 6 Dec 2021 18:49:19 +0100 Subject: [PATCH 42/56] Syntax: Add http support in fenced code blocks --- syntaxes/Markdown.sublime-syntax | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/syntaxes/Markdown.sublime-syntax b/syntaxes/Markdown.sublime-syntax index 0a2fadfa..63cf1fbb 100644 --- a/syntaxes/Markdown.sublime-syntax +++ b/syntaxes/Markdown.sublime-syntax @@ -687,6 +687,7 @@ contexts: - include: fenced-elixir - include: fenced-fish - include: fenced-graphql + - include: fenced-http - include: fenced-ini - include: fenced-jade - include: fenced-julia @@ -1508,6 +1509,23 @@ contexts: 0: meta.code-fence.definition.end.graphql.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown + fenced-http: + - match: |- + (?x) + {{fenced_code_block_start}} + ((?i:http)) + {{fenced_code_block_trailing_infostring_characters}} + captures: + 0: meta.code-fence.definition.begin.http.markdown-gfm + 2: punctuation.definition.raw.code-fence.begin.markdown + 5: constant.other.language-name.markdown + embed: scope:text.http-request-response + embed_scope: markup.raw.code-fence.http.markdown-gfm + escape: '{{code_fence_escape}}' + escape_captures: + 0: meta.code-fence.definition.end.http.markdown-gfm + 1: punctuation.definition.raw.code-fence.end.markdown + fenced-ini: - match: |- (?x) From 2ded31adb2394e28ef1041480281b82c3b86a529 Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Mon, 6 Dec 2021 18:52:52 +0100 Subject: [PATCH 43/56] Syntax: Add rss/xsd/... language names --- syntaxes/Markdown.sublime-syntax | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntaxes/Markdown.sublime-syntax b/syntaxes/Markdown.sublime-syntax index 63cf1fbb..cf100cfe 100644 --- a/syntaxes/Markdown.sublime-syntax +++ b/syntaxes/Markdown.sublime-syntax @@ -1323,7 +1323,7 @@ contexts: - match: |- (?x) {{fenced_code_block_start}} - ((?i:xml)) + ((?i:atom|plist|svg|xjb|xml|xsd|xsl)) {{fenced_code_block_trailing_infostring_characters}} captures: 0: meta.code-fence.definition.begin.xml.markdown-gfm From 74e41e5e8c5f07928c32a6fa80a5c5f3b2293422 Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Mon, 6 Dec 2021 18:57:45 +0100 Subject: [PATCH 44/56] Syntax: Add Twig support in fenced code blocks --- syntaxes/Markdown.sublime-syntax | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/syntaxes/Markdown.sublime-syntax b/syntaxes/Markdown.sublime-syntax index cf100cfe..cd62ee90 100644 --- a/syntaxes/Markdown.sublime-syntax +++ b/syntaxes/Markdown.sublime-syntax @@ -705,6 +705,7 @@ contexts: - include: fenced-svelte - include: fenced-swift - include: fenced-toml + - include: fenced-twig - include: fenced-xonsh fenced-clojure: @@ -1817,6 +1818,23 @@ contexts: 0: meta.code-fence.definition.end.toml.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown + fenced-twig: + - match: |- + (?x) + {{fenced_code_block_start}} + ((?i:twig|craftcms)) + {{fenced_code_block_trailing_infostring_characters}} + captures: + 0: meta.code-fence.definition.begin.twig.markdown-gfm + 2: punctuation.definition.raw.code-fence.begin.markdown + 5: constant.other.language-name.markdown + embed: scope:text.html.twig + embed_scope: markup.raw.code-fence.twig.markdown-gfm + escape: '{{code_fence_escape}}' + escape_captures: + 0: meta.code-fence.definition.end.twig.markdown-gfm + 1: punctuation.definition.raw.code-fence.end.markdown + fenced-xonsh: - match: |- (?x) From 18447f3d2d4a9283f6c553d2523fc8abcbdabb17 Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Mon, 6 Dec 2021 19:01:00 +0100 Subject: [PATCH 45/56] Syntax: Add Terraform support in fenced code blocks --- syntaxes/Markdown.sublime-syntax | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/syntaxes/Markdown.sublime-syntax b/syntaxes/Markdown.sublime-syntax index cd62ee90..ec0670b4 100644 --- a/syntaxes/Markdown.sublime-syntax +++ b/syntaxes/Markdown.sublime-syntax @@ -704,6 +704,7 @@ contexts: - include: fenced-stata - include: fenced-svelte - include: fenced-swift + - include: fenced-terraform - include: fenced-toml - include: fenced-twig - include: fenced-xonsh @@ -1801,6 +1802,23 @@ contexts: 0: meta.code-fence.definition.end.swift.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown + fenced-terraform: + - match: |- + (?x) + {{fenced_code_block_start}} + ((?i:terraform|tf|hcl)) + {{fenced_code_block_trailing_infostring_characters}} + captures: + 0: meta.code-fence.definition.begin.terraform.markdown-gfm + 2: punctuation.definition.raw.code-fence.begin.markdown + 5: constant.other.language-name.markdown + embed: scope:source.json.terraform + embed_scope: markup.raw.code-fence.terraform.markdown-gfm + escape: '{{code_fence_escape}}' + escape_captures: + 0: meta.code-fence.definition.end.terraform.markdown-gfm + 1: punctuation.definition.raw.code-fence.end.markdown + fenced-toml: - match: |- (?x) From 38ed93a2e39d8dd5d6c3dbc662cea1bba5e64d11 Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Mon, 6 Dec 2021 19:02:53 +0100 Subject: [PATCH 46/56] Syntax: Add Verilog support in fenced code blocks --- syntaxes/Markdown.sublime-syntax | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/syntaxes/Markdown.sublime-syntax b/syntaxes/Markdown.sublime-syntax index ec0670b4..bde76a25 100644 --- a/syntaxes/Markdown.sublime-syntax +++ b/syntaxes/Markdown.sublime-syntax @@ -707,6 +707,7 @@ contexts: - include: fenced-terraform - include: fenced-toml - include: fenced-twig + - include: fenced-verilog - include: fenced-xonsh fenced-clojure: @@ -1853,6 +1854,23 @@ contexts: 0: meta.code-fence.definition.end.twig.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown + fenced-verilog: + - match: |- + (?x) + {{fenced_code_block_start}} + ((?i:verilog|v)) + {{fenced_code_block_trailing_infostring_characters}} + captures: + 0: meta.code-fence.definition.begin.verilog.markdown-gfm + 2: punctuation.definition.raw.code-fence.begin.markdown + 5: constant.other.language-name.markdown + embed: scope:source.verilog + embed_scope: markup.raw.code-fence.verilog.markdown-gfm + escape: '{{code_fence_escape}}' + escape_captures: + 0: meta.code-fence.definition.end.verilog.markdown-gfm + 1: punctuation.definition.raw.code-fence.end.markdown + fenced-xonsh: - match: |- (?x) From 87cf0be66efbfd3a99676779edaa92bcac796b35 Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Mon, 6 Dec 2021 19:04:04 +0100 Subject: [PATCH 47/56] Syntax: Add Console language name --- syntaxes/Markdown.sublime-syntax | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntaxes/Markdown.sublime-syntax b/syntaxes/Markdown.sublime-syntax index bde76a25..8d0ce5c8 100644 --- a/syntaxes/Markdown.sublime-syntax +++ b/syntaxes/Markdown.sublime-syntax @@ -1258,7 +1258,7 @@ contexts: - match: |- (?x) {{fenced_code_block_start}} - ((?i:shell(?:-script)?|sh|bash|zsh)) + ((?i:console|shell(?:-script)?|sh|bash|zsh)) {{fenced_code_block_trailing_infostring_characters}} captures: 0: meta.code-fence.definition.begin.shell-script.markdown-gfm From 1e59ea05cc573d4837a837eaf36364254ae103e2 Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Mon, 6 Dec 2021 19:07:40 +0100 Subject: [PATCH 48/56] Syntax: Add CoffeeScript language names --- syntaxes/Markdown.sublime-syntax | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntaxes/Markdown.sublime-syntax b/syntaxes/Markdown.sublime-syntax index 8d0ce5c8..5dce4afb 100644 --- a/syntaxes/Markdown.sublime-syntax +++ b/syntaxes/Markdown.sublime-syntax @@ -1414,7 +1414,7 @@ contexts: - match: |- (?x) {{fenced_code_block_start}} - ((?i:coffee|cjsx)) + ((?i:coffee(?:script)?|cjsx|cson|iced)) {{fenced_code_block_trailing_infostring_characters}} captures: 0: meta.code-fence.definition.begin.coffee.markdown-gfm From 4d0c19ff702235e4f52446b7ab1e296b27e1309c Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Mon, 6 Dec 2021 19:10:08 +0100 Subject: [PATCH 49/56] Syntax: Add C/C++ language names --- syntaxes/Markdown.sublime-syntax | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/syntaxes/Markdown.sublime-syntax b/syntaxes/Markdown.sublime-syntax index 5dce4afb..103fe268 100644 --- a/syntaxes/Markdown.sublime-syntax +++ b/syntaxes/Markdown.sublime-syntax @@ -731,7 +731,7 @@ contexts: - match: |- (?x) {{fenced_code_block_start}} - ((?i:c)) + ((?i:c|h)) {{fenced_code_block_trailing_infostring_characters}} captures: 0: meta.code-fence.definition.begin.c.markdown-gfm @@ -748,7 +748,7 @@ contexts: - match: |- (?x) {{fenced_code_block_start}} - ((?i:c\+\+|cpp)) + ((?i:c\+\+|cc|cpp|cxx|h\+\+|hpp|hxx)) {{fenced_code_block_trailing_infostring_characters}} captures: 0: meta.code-fence.definition.begin.c++.markdown-gfm From f0fce1a433d2a2ecef45e056d23a3564163b905a Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Mon, 6 Dec 2021 19:12:55 +0100 Subject: [PATCH 50/56] Syntax: Add AppleScript support in fenced code blocks --- syntaxes/Markdown.sublime-syntax | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/syntaxes/Markdown.sublime-syntax b/syntaxes/Markdown.sublime-syntax index 103fe268..322adfd8 100644 --- a/syntaxes/Markdown.sublime-syntax +++ b/syntaxes/Markdown.sublime-syntax @@ -640,6 +640,7 @@ contexts: - include: fenced-raw fenced-syntaxes: + - include: fenced-applescript - include: fenced-clojure - include: fenced-c - include: fenced-cpp @@ -710,6 +711,23 @@ contexts: - include: fenced-verilog - include: fenced-xonsh + fenced-applescript: + - match: |- + (?x) + {{fenced_code_block_start}} + ((?i:applescript|osascript)) + {{fenced_code_block_trailing_infostring_characters}} + captures: + 0: meta.code-fence.definition.begin.applescript.markdown-gfm + 2: punctuation.definition.raw.code-fence.begin.markdown + 5: constant.other.language-name.markdown + embed: scope:source.applescript + embed_scope: markup.raw.code-fence.applescript.markdown-gfm + escape: '{{code_fence_escape}}' + escape_captures: + 0: meta.code-fence.definition.end.applescript.markdown-gfm + 1: punctuation.definition.raw.code-fence.end.markdown + fenced-clojure: - match: |- (?x) From c6ed09b1a5a4886ecff51be0f118d4b0b5c52065 Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Mon, 6 Dec 2021 19:13:12 +0100 Subject: [PATCH 51/56] Syntax: Add ActionScript support in fenced code blocks --- syntaxes/Markdown.sublime-syntax | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/syntaxes/Markdown.sublime-syntax b/syntaxes/Markdown.sublime-syntax index 322adfd8..ae925c18 100644 --- a/syntaxes/Markdown.sublime-syntax +++ b/syntaxes/Markdown.sublime-syntax @@ -640,6 +640,7 @@ contexts: - include: fenced-raw fenced-syntaxes: + - include: fenced-actionscript - include: fenced-applescript - include: fenced-clojure - include: fenced-c @@ -711,6 +712,23 @@ contexts: - include: fenced-verilog - include: fenced-xonsh + fenced-actionscript: + - match: |- + (?x) + {{fenced_code_block_start}} + ((?i:actionscript|as)) + {{fenced_code_block_trailing_infostring_characters}} + captures: + 0: meta.code-fence.definition.begin.actionscript.markdown-gfm + 2: punctuation.definition.raw.code-fence.begin.markdown + 5: constant.other.language-name.markdown + embed: scope:source.actionscript.2 + embed_scope: markup.raw.code-fence.actionscript.markdown-gfm + escape: '{{code_fence_escape}}' + escape_captures: + 0: meta.code-fence.definition.end.actionscript.markdown-gfm + 1: punctuation.definition.raw.code-fence.end.markdown + fenced-applescript: - match: |- (?x) From 7a81c51603a84b0acbbb81be2be6a7df7f7e10fe Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Mon, 6 Dec 2021 19:15:30 +0100 Subject: [PATCH 52/56] Syntax: Add Arduino support in fenced code blocks --- syntaxes/Markdown.sublime-syntax | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/syntaxes/Markdown.sublime-syntax b/syntaxes/Markdown.sublime-syntax index ae925c18..f01c3145 100644 --- a/syntaxes/Markdown.sublime-syntax +++ b/syntaxes/Markdown.sublime-syntax @@ -683,6 +683,7 @@ contexts: # 3rd-party syntaxes - include: fenced-ada - include: fenced-akh + - include: fenced-arduino - include: fenced-coffee - include: fenced-dart - include: fenced-docker @@ -1446,6 +1447,23 @@ contexts: 0: meta.code-fence.definition.end.akh.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown + fenced-arduino: + - match: |- + (?x) + {{fenced_code_block_start}} + ((?i:arduino|ino)) + {{fenced_code_block_trailing_infostring_characters}} + captures: + 0: meta.code-fence.definition.begin.arduino.markdown-gfm + 2: punctuation.definition.raw.code-fence.begin.markdown + 5: constant.other.language-name.markdown + embed: scope:source.arduino + embed_scope: markup.raw.code-fence.arduino.markdown-gfm + escape: '{{code_fence_escape}}' + escape_captures: + 0: meta.code-fence.definition.end.arduino.markdown-gfm + 1: punctuation.definition.raw.code-fence.end.markdown + fenced-coffee: - match: |- (?x) From 586158005b4d6b57a1b312db6501e46db492378f Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Mon, 6 Dec 2021 21:14:39 +0100 Subject: [PATCH 53/56] Syntax: Add named contexts for attribute string values --- syntaxes/Markdown.sublime-syntax | 38 ++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/syntaxes/Markdown.sublime-syntax b/syntaxes/Markdown.sublime-syntax index f01c3145..90318195 100644 --- a/syntaxes/Markdown.sublime-syntax +++ b/syntaxes/Markdown.sublime-syntax @@ -2858,27 +2858,33 @@ contexts: tag-attr-value: - match: \" scope: punctuation.definition.string.begin.markdown - set: - - meta_scope: string.quoted.double.markdown - - match: \" - scope: punctuation.definition.string.end.markdown - pop: true + set: tag-attr-value-double-quoted - match: \' scope: punctuation.definition.string.begin.markdown - set: - - meta_scope: string.quoted.single.markdown - - match: \' - scope: punctuation.definition.string.end.markdown - pop: true + set: tag-attr-value-single-quoted - match: '{{tag_unquoted_attribute_start}}' - set: - - meta_scope: string.unquoted.markdown - - match: '{{tag_unquoted_attribute_break}}' - pop: true - - match: '["''`<]' - scope: invalid.illegal.attribute-value.markdown + set: tag-attr-value-unquoted - include: else-pop + tag-attr-value-double-quoted: + - meta_scope: string.quoted.double.markdown + - match: \" + scope: punctuation.definition.string.end.markdown + pop: true + + tag-attr-value-single-quoted: + - meta_scope: string.quoted.single.markdown + - match: \' + scope: punctuation.definition.string.end.markdown + pop: true + + tag-attr-value-unquoted: + - meta_scope: string.unquoted.markdown + - match: '{{tag_unquoted_attribute_break}}' + pop: true + - match: '["''`<]' + scope: invalid.illegal.attribute-value.markdown + ###[ INLINE: AUTOLINKS ]###################################################### autolink-email: From ca884204d2d948de3f59bab9817c86fa1f05a61b Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Sat, 11 Dec 2021 15:50:21 +0100 Subject: [PATCH 54/56] Syntax: Fix block quotes in list items --- syntaxes/Markdown.sublime-syntax | 2 +- tests/syntax_test_markdown.md | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/syntaxes/Markdown.sublime-syntax b/syntaxes/Markdown.sublime-syntax index 90318195..7f3df551 100644 --- a/syntaxes/Markdown.sublime-syntax +++ b/syntaxes/Markdown.sublime-syntax @@ -466,7 +466,7 @@ contexts: list-content: - meta_content_scope: meta.paragraph.list.markdown - - include: list-block-quotes + - include: block-quotes - include: fenced-code-blocks - include: html-blocks - include: latex-blocks diff --git a/tests/syntax_test_markdown.md b/tests/syntax_test_markdown.md index c4d56a19..274d5e0d 100644 --- a/tests/syntax_test_markdown.md +++ b/tests/syntax_test_markdown.md @@ -1127,6 +1127,10 @@ because it doesn't begin with the number one: > This is a blockquote. | ^ markup.list.unnumbered markup.quote punctuation.definition.blockquote + - this is a list + > This is a blockquote. +| ^ markup.list.unnumbered markup.quote punctuation.definition.blockquote + This is a paragraph still part of the list item | ^^^^^^^^^ markup.list.unnumbered meta.paragraph.list - meta.paragraph.list meta.paragraph.list From fa04b91bc0f6b8a67ffcbf3d7a8b321b95ea54dc Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Sat, 11 Dec 2021 18:02:32 +0100 Subject: [PATCH 55/56] Syntax: Reorganize variables --- syntaxes/Markdown.sublime-syntax | 337 ++++++++++++++++--------------- 1 file changed, 172 insertions(+), 165 deletions(-) diff --git a/syntaxes/Markdown.sublime-syntax b/syntaxes/Markdown.sublime-syntax index 7f3df551..01576294 100644 --- a/syntaxes/Markdown.sublime-syntax +++ b/syntaxes/Markdown.sublime-syntax @@ -19,104 +19,109 @@ file_extensions: - markdn variables: + atx_heading: (?:[ ]{,3}[#]{1,6}(?:[ \t]|$)) # between 0 and 3 spaces, followed 1 to 6 hashes, followed by at least one space or tab or by end of the line + atx_heading_space: (?:(?=[ \t]+#+[ \t]*$)|[ \t]+|$) # consume spaces only if heading is not empty to ensure `atx_heading_end` can fully match closing hashes + atx_heading_end: (?:[ \t]+(#+))?[ \t]*($\n?) # \n is optional so ## is matched as end punctuation in new document (at eof) + setext_escape: ^(?=[ ]{,3}(?:=+|-+)\s*$) # between 0 and 3 spaces, followed by at least one hyphon or equal sign (setext underline can be of any length) + + block_quote: (?:[ ]{,3}(>)[ ]?) # between 0 and 3 spaces, followed by a greater than sign, (followed by any character or the end of the line = "only care about optional space!") + indented_code_block: (?:[ ]{4}|\t) # 4 spaces or a tab + list_item: (?:[ ]{,3}(?:\d+[.)]|[*+-])\s) # between 0 and 3 spaces, followed by either: at least one integer and a full stop or a parenthesis, or (a star, plus or dash), followed by whitespace thematic_break: |- - (?x: - [ ]{,3} # between 0 to 3 spaces - (?: # followed by one of the following: - [-](?:[ ]{,2}[-]){2,} # - a dash, followed by the following at least twice: between 0 to 2 spaces followed by a dash - | [*](?:[ ]{,2}[*]){2,} # - a star, followed by the following at least twice: between 0 to 2 spaces followed by a star - | [_](?:[ ]{,2}[_]){2,} # - an underscore, followed by the following at least twice: between 0 to 2 spaces followed by an underscore - ) - [ \t]*$ # followed by any number of tabs or spaces, followed by the end of the line + (?x: + [ ]{,3} # between 0 to 3 spaces + (?: # followed by one of the following: + [-](?:[ ]{,2}[-]){2,} # - a dash, followed by the following at least twice: between 0 to 2 spaces followed by a dash + | [*](?:[ ]{,2}[*]){2,} # - a star, followed by the following at least twice: between 0 to 2 spaces followed by a star + | [_](?:[ ]{,2}[_]){2,} # - an underscore, followed by the following at least twice: between 0 to 2 spaces followed by an underscore ) - block_quote: (?:[ ]{,3}(>)[ ]?) # between 0 and 3 spaces, followed by a greater than sign, (followed by any character or the end of the line = "only care about optional space!") - atx_heading: (?:[ ]{,3}[#]{1,6}(?:[ \t]|$)) # between 0 and 3 spaces, followed 1 to 6 hashes, followed by at least one space or tab or by end of the line - atx_heading_space: (?:(?=[ \t]+#+[ \t]*$)|[ \t]+|$) # consume spaces only if heading is not empty to ensure `atx_heading_end` can fully match closing hashes - atx_heading_end: (?:[ \t]+(#+))?[ \t]*($\n?) # \n is optional so ## is matched as end punctuation in new document (at eof) - setext_escape: ^(?=[ ]{,3}(?:=+|-+)\s*$) # between 0 and 3 spaces, followed by at least one hyphon or equal sign (setext underline can be of any length) - indented_code_block: (?:[ ]{4}|\t) # 4 spaces or a tab - list_item: (?:[ ]{,3}(?:\d+[.)]|[*+-])\s) # between 0 and 3 spaces, followed by either: at least one integer and a full stop or a parenthesis, or (a star, plus or dash), followed by whitespace - escape: '\\[-`*_#+.!(){}\[\]\\>|~<]' + [ \t]*$ # followed by any number of tabs or spaces, followed by the end of the line + ) + backticks: |- - (?x: - (`{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 - | (`{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 - | (`{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 - | (`{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 - ) + (?x: + (`{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 + | (`{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 + | (`{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 + | (`{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 + ) + escape: \\[-`*_#+.!(){}\[\]\\>|~<] + balance_square_brackets: |- - (?x: - (?: - {{escape}}+ # escape characters - | [^\[\]`\\]+(?=[\[\]`\\]|$) # anything that isn't a square bracket or a backtick or the start of an escape character - | {{backticks}} # inline code - | \[(?: # nested square brackets (one level deep) - [^\[\]`]+(?=[\[\]`]) # anything that isn't a square bracket or a backtick - {{backticks}}? # balanced backticks - )*\] # closing square bracket - )+ # at least one character - ) - html_entity: '&([a-zA-Z0-9]+|#\d+|#x\h+);' - skip_html_tags: (?:<[^>]+>) + (?x: + (?: + {{escape}}+ # escape characters + | [^\[\]`\\]+(?=[\[\]`\\]|$) # anything that isn't a square bracket or a backtick or the start of an escape character + | {{backticks}} # inline code + | \[(?: # nested square brackets (one level deep) + [^\[\]`]+(?=[\[\]`]) # anything that isn't a square bracket or a backtick + {{backticks}}? # balanced backticks + )*\] # closing square bracket + )+ + ) balance_square_brackets_and_emphasis: |- - (?x: - (?: - {{escape}}+ # escape characters - | [^\[\]`\\_*]+(?=[\[\]`\\_*]|$) # anything that isn't a square bracket, a backtick, the start of an escape character, or an emphasis character - | {{backticks}} # inline code - | \[(?: # nested square brackets (one level deep) - [^\[\]`]+(?=[\[\]`]) # anything that isn't a square bracket or a backtick - {{backticks}}? # balanced backticks - )*\] # closing square bracket - )+ # at least one character - ) + (?x: + (?: + {{escape}}+ # escape characters + | [^\[\]`\\_*]+(?=[\[\]`\\_*]|$) # anything that isn't a square bracket, a backtick, the start of an escape character, or an emphasis character + | {{backticks}} # inline code + | \[(?: # nested square brackets (one level deep) + [^\[\]`]+(?=[\[\]`]) # anything that isn't a square bracket or a backtick + {{backticks}}? # balanced backticks + )*\] # closing square bracket + )+ # at least one character + ) balance_square_brackets_pipes_and_emphasis: |- - (?x: - (?: - {{escape}}+ # escape characters - | [^\[\]`\\_*|]+(?=[\[\]`\\_*|]|$) # anything that isn't a square bracket, a backtick, the start of an escape character, or an emphasis character - | {{backticks}} # inline code - | \[(?: # nested square brackets (one level deep) - [^\[\]`]+(?=[\[\]`]) # anything that isn't a square bracket or a backtick - {{backticks}}? # balanced backticks - )*\] # closing square bracket - )+ # at least one character - ) + (?x: + (?: + {{escape}}+ # escape characters + | [^\[\]`\\_*|]+(?=[\[\]`\\_*|]|$) # anything that isn't a square bracket, a backtick, the start of an escape character, or an emphasis character + | {{backticks}} # inline code + | \[(?: # nested square brackets (one level deep) + [^\[\]`]+(?=[\[\]`]) # anything that isn't a square bracket or a backtick + {{backticks}}? # balanced backticks + )*\] # closing square bracket + )+ # at least one character + ) balanced_emphasis: |- (?x: - \* (?!\*){{balance_square_brackets_and_emphasis}}+\* (?!\*) - | \*\* {{balance_square_brackets_and_emphasis}}+\*\* - | _ (?!_) {{balance_square_brackets_and_emphasis}}+_ (?!_) - | __ {{balance_square_brackets_and_emphasis}}+__ + \* (?!\*){{balance_square_brackets_and_emphasis}}+\* (?!\*) + | \*\* {{balance_square_brackets_and_emphasis}}+\*\* + | _ (?!_) {{balance_square_brackets_and_emphasis}}+_ (?!_) + | __ {{balance_square_brackets_and_emphasis}}+__ ) - balanced_table_cell: |- # Pipes inside other inline spans (such as emphasis, code, etc.) will not break a cell, emphasis in table cells can't span multiple lines + + table_cell: |- (?x: + # Pipes inside other inline spans (such as emphasis, code, etc.) will not break a cell, + # emphasis in table cells can't span multiple lines (?: {{balance_square_brackets_pipes_and_emphasis}} | {{balanced_emphasis}} - )+ # at least one character + )+ # at least one character ) table_first_row: |- - (?x: - # at least 2 non-escaped pipe chars on the line - (?:{{balanced_table_cell}}?\|){2} + (?x: + # at least 2 non-escaped pipe chars on the line + (?:{{table_cell}}?\|){2} + + # something other than whitespace followed by a pipe char or hyphon, + # followed by something other than whitespace and the end of the line + | (?! \s*\-\s+ | \s+\|){{table_cell}}\|(?!\s+$) + ) - # something other than whitespace followed by a pipe char or hyphon, - # followed by something other than whitespace and the end of the line - | (?! \s*\-\s+ | \s+\|){{balanced_table_cell}}\|(?!\s+$) - ) fenced_code_block_start: |- - (?x: - ([ \t]*) - ( - (`){3,} # 3 or more backticks - (?![^`]*`) # not followed by any more backticks on the same line - | # or - (~){3,} # 3 or more tildas - (?![^~]*~) # not followed by any more tildas on the same line - ) - \s* # allow for whitespace between code block start and info string + (?x: + ([ \t]*) + ( + (`){3,} # 3 or more backticks + (?![^`]*`) # not followed by any more backticks on the same line + | # or + (~){3,} # 3 or more tildas + (?![^~]*~) # not followed by any more tildas on the same line ) + \s* # allow for whitespace between code block start and info string + ) fenced_code_block_language: |- (?x: # first word of an infostring is used as language specifier ( @@ -125,24 +130,24 @@ variables: ) ) fenced_code_block_trailing_infostring_characters: |- - (?x: - ( - \s* # any whitespace, or .. - | - \s[^`]* # any characters (except backticks), separated by whitespace ... - ) - $\n? # ... until EOL + (?x: + ( + \s* # any whitespace, or .. + | + \s[^`]* # any characters (except backticks), separated by whitespace ... ) - code_fence_escape: ^{{code_fence_end}} - code_fence_end: |- + $\n? # ... until EOL + ) + fenced_code_block_end: |- (?x: [ \t]* ( - \2 # the backtick/tilde combination that opened the code fence - (?:\3|\4)* # plus optional additional closing characters + \2 # the backtick/tilde combination that opened the code fence + (?:\3|\4)* # plus optional additional closing characters ) - \s*$ # any amount of whitespace until EOL + \s*$ # any amount of whitespace until EOL ) + fenced_code_block_escape: ^{{fenced_code_block_end}} # https://spec.commonmark.org/0.30/#email-autolink email_domain_commonmark: '[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?' @@ -202,6 +207,8 @@ variables: html_tag_break_char: (?:[ \t>]|$) html_tag_maybe_selfclosing_break_char: (?:[ \t]|/?>|$) + html_entity: '&([a-zA-Z0-9]+|#\d+|#x\h+);' + ascii_space: '\t\n\f ' tag_attribute_name_start: (?=[^{{ascii_space}}=/>}]) tag_attribute_name_break: (?=[{{ascii_space}}=/>}]) @@ -325,7 +332,7 @@ contexts: block-quote-code-block-content: - match: ^(?!\s*{{block_quote}}) pop: true - - match: '{{code_fence_end}}' + - match: '{{fenced_code_block_end}}' captures: 0: meta.code-fence.definition.end.text.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -725,7 +732,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.actionscript.2 embed_scope: markup.raw.code-fence.actionscript.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.actionscript.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -742,7 +749,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.applescript embed_scope: markup.raw.code-fence.applescript.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.applescript.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -759,7 +766,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.clojure embed_scope: markup.raw.code-fence.clojure.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.clojure.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -776,7 +783,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.c embed_scope: markup.raw.code-fence.c.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.c.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -793,7 +800,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.c++ embed_scope: markup.raw.code-fence.c++.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.c++.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -810,7 +817,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.cs embed_scope: markup.raw.code-fence.csharp.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.csharp.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -827,7 +834,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.css embed_scope: markup.raw.code-fence.css.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.css.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -844,7 +851,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.diff embed_scope: markup.raw.code-fence.diff.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.diff.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -861,7 +868,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.dosbatch embed_scope: markup.raw.code-fence.dosbatch.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.dosbatch.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -878,7 +885,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.erlang embed_scope: markup.raw.code-fence.erlang.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.erlang.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -895,7 +902,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.dot embed_scope: markup.raw.code-fence.graphviz.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.graphviz.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -912,7 +919,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.go embed_scope: markup.raw.code-fence.go.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.go.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -929,7 +936,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.haskell embed_scope: markup.raw.code-fence.haskell.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.haskell.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -946,7 +953,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:embedding.php embed_scope: markup.raw.code-fence.html-php.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.html-php.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -963,7 +970,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:text.html.basic embed_scope: markup.raw.code-fence.html.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.html.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -980,7 +987,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.java embed_scope: markup.raw.code-fence.java.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.java.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -997,7 +1004,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.js embed_scope: markup.raw.code-fence.javascript.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.javascript.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1014,7 +1021,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.json embed_scope: markup.raw.code-fence.json.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.json.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1031,7 +1038,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:text.html.jsp embed_scope: markup.raw.code-fence.jsp.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.jsp.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1048,7 +1055,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.jsx embed_scope: markup.raw.code-fence.jsx.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.jsx.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1065,7 +1072,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.lisp embed_scope: markup.raw.code-fence.lisp.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.lisp.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1082,7 +1089,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.lua embed_scope: markup.raw.code-fence.lua.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.lua.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1099,7 +1106,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.matlab embed_scope: markup.raw.code-fence.matlab.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.matlab.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1116,7 +1123,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.objc embed_scope: markup.raw.code-fence.objc.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.objc.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1133,7 +1140,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.objc++ embed_scope: markup.raw.code-fence.objc++.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.objc++.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1150,7 +1157,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.ocaml embed_scope: markup.raw.code-fence.ocaml.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.ocaml.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1167,7 +1174,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.perl embed_scope: markup.raw.code-fence.perl.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.perl.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1184,7 +1191,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.php embed_scope: markup.raw.code-fence.php.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.php.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1201,7 +1208,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.python embed_scope: markup.raw.code-fence.python.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.python.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1218,7 +1225,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.regexp embed_scope: markup.raw.code-fence.regexp.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.regexp.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1235,7 +1242,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.r embed_scope: markup.raw.code-fence.r.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.r.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1252,7 +1259,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.ruby embed_scope: markup.raw.code-fence.ruby.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.ruby.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1269,7 +1276,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.rust embed_scope: markup.raw.code-fence.rust.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.rust.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1286,7 +1293,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.scala embed_scope: markup.raw.code-fence.scala.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.scala.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1303,7 +1310,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.shell.bash embed_scope: markup.raw.code-fence.shell-script.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.shell-script.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1320,7 +1327,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.sql embed_scope: markup.raw.code-fence.sql.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.sql.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1337,7 +1344,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.tsx embed_scope: markup.raw.code-fence.tsx.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.tsx.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1354,7 +1361,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.ts embed_scope: markup.raw.code-fence.typescript.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.typescript.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1371,7 +1378,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:text.xml embed_scope: markup.raw.code-fence.xml.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.xml.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1388,7 +1395,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.yaml embed_scope: markup.raw.code-fence.yaml.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.yaml.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1407,7 +1414,7 @@ contexts: fenced-raw-content: - meta_content_scope: markup.raw.code-fence.markdown-gfm - - match: '{{code_fence_escape}}' + - match: '{{fenced_code_block_escape}}' captures: 0: meta.code-fence.definition.end.text.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1425,7 +1432,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.ada embed_scope: markup.raw.code-fence.ada.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.ada.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1442,7 +1449,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.akh embed_scope: markup.raw.code-fence.akh.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.akh.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1459,7 +1466,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.arduino embed_scope: markup.raw.code-fence.arduino.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.arduino.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1476,7 +1483,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.coffee embed_scope: markup.raw.code-fence.coffee.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.coffee.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1493,7 +1500,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.dart embed_scope: markup.raw.code-fence.dart.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.dart.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1510,7 +1517,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.shell.docker embed_scope: markup.raw.code-fence.docker.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.docker.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1527,7 +1534,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.elixir embed_scope: markup.raw.code-fence.elixir.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.elixir.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1544,7 +1551,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.shell.fish embed_scope: markup.raw.code-fence.fish.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.fish.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1561,7 +1568,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.graphql embed_scope: markup.raw.code-fence.graphql.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.graphql.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1578,7 +1585,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:text.http-request-response embed_scope: markup.raw.code-fence.http.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.http.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1595,7 +1602,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.ini embed_scope: markup.raw.code-fence.ini.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.ini.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1612,7 +1619,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.jade embed_scope: markup.raw.code-fence.jade.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.jade.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1629,7 +1636,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.julia embed_scope: markup.raw.code-fence.julia.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.julia.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1646,7 +1653,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.kotlin embed_scope: markup.raw.code-fence.kotlin.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.kotlin.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1663,7 +1670,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.less embed_scope: markup.raw.code-fence.less.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.less.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1682,7 +1689,7 @@ contexts: embed_scope: markup.raw.code-fence.mermaid.markdown-gfm source.mermaid.embedded.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.mermaid.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1699,7 +1706,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.nim embed_scope: markup.raw.code-fence.nim.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.nim.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1716,7 +1723,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.powershell embed_scope: markup.raw.code-fence.powershell.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.powershell.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1733,7 +1740,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.proto embed_scope: markup.raw.code-fence.protobuf.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.protobuf.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1750,7 +1757,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.reason embed_scope: markup.raw.code-fence.reason.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.reason.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1767,7 +1774,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.sass embed_scope: markup.raw.code-fence.sass.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.sass.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1784,7 +1791,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.scheme embed_scope: markup.raw.code-fence.scheme.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.scheme.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1801,7 +1808,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.scss embed_scope: markup.raw.code-fence.scss.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.scss.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1818,7 +1825,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.stata embed_scope: markup.raw.code-fence.stata.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.stata.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1835,7 +1842,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:text.html.svelte embed_scope: markup.raw.code-fence.svelte.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.svelte.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1852,7 +1859,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.swift embed_scope: markup.raw.code-fence.swift.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.swift.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1869,7 +1876,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.json.terraform embed_scope: markup.raw.code-fence.terraform.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.terraform.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1886,7 +1893,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.toml embed_scope: markup.raw.code-fence.toml.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.toml.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1903,7 +1910,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:text.html.twig embed_scope: markup.raw.code-fence.twig.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.twig.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1920,7 +1927,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.verilog embed_scope: markup.raw.code-fence.verilog.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.verilog.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown @@ -1937,7 +1944,7 @@ contexts: 5: constant.other.language-name.markdown embed: scope:source.python embed_scope: markup.raw.code-fence.xonsh.markdown-gfm - escape: '{{code_fence_escape}}' + escape: '{{fenced_code_block_escape}}' escape_captures: 0: meta.code-fence.definition.end.xonsh.markdown-gfm 1: punctuation.definition.raw.code-fence.end.markdown From 55822aeb750aa99491c08d3d390c7a9abcaa8c3c Mon Sep 17 00:00:00 2001 From: DeathAxe Date: Sat, 11 Dec 2021 17:28:43 +0100 Subject: [PATCH 56/56] Update CHANGELOG --- messages/3.1.0.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/messages/3.1.0.md b/messages/3.1.0.md index 5908aa38..597bae0f 100644 --- a/messages/3.1.0.md +++ b/messages/3.1.0.md @@ -9,9 +9,23 @@ feedback you can use [GitHub issues][issues]. * Display correct key for `MarkdownEditing: Decrease Heading Level` in Command Palette * Use better table border color of Mariana color scheme * List MarkdownEditor-\*.tmTheme color schemes (see #666) +* Improve bailouts from tables to fix highlighting of links after lines with pipes ## New Features +* Added support for various syntaxes in fenced code blocks + - ActionScript + - AppleScript + - Arduino + - CSS + - HTTP request/response + - Terraform + - Twig + - Verilog + ## Changes +* Markdown.sublime-syntax has been refactored to increase readability, + fix several issues and prepare for future ST4 only changes. + [issues]: https://github.com/SublimeText-Markdown/MarkdownEditing/issues