Skip to content

Commit

Permalink
[Markdown] Fix premature block quote termination
Browse files Browse the repository at this point in the history
Fixes sublimehq#3892 (comment)

Follow up commit for sublimehq#3892.
  • Loading branch information
deathaxe committed Dec 30, 2023
1 parent e420984 commit 888cb19
Show file tree
Hide file tree
Showing 2 changed files with 124 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Markdown/Markdown.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -631,14 +631,14 @@ contexts:
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
set: block-quote-unordered-list-block-body
push: block-quote-unordered-list-block-body
- match: ([ \t]*)(\d{1,9}([.)]))(\s)
captures:
1: markup.list.numbered.markdown
2: markup.list.numbered.bullet.markdown
3: punctuation.definition.list_item.markdown
4: markup.list.numbered.markdown
set: block-quote-ordered-list-block-body
push: block-quote-ordered-list-block-body

block-quote-ordered-list-block-body:
- meta_content_scope: markup.list.numbered.markdown
Expand Down Expand Up @@ -697,7 +697,7 @@ contexts:

block-quote-paragraph:
- match: '[ \t]*(?=\S)'
set: block-quote-paragraph-body
push: block-quote-paragraph-body

block-quote-paragraph-body:
- meta_scope: markup.paragraph.markdown
Expand Down Expand Up @@ -860,7 +860,7 @@ contexts:

list-block-quote-paragraph:
- match: '[ \t]*(?=\S)'
set: list-block-quote-paragraph-body
push: list-block-quote-paragraph-body

list-block-quote-paragraph-body:
- meta_scope: markup.paragraph.markdown
Expand Down
120 changes: 120 additions & 0 deletions Markdown/tests/syntax_test_markdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -8209,6 +8209,66 @@ This is a [[wiki link]].
|^ markup.quote.alert.caution.markdown - markup.paragraph
| ^^^^^ markup.quote.alert.caution.markdown markup.paragraph.markdown
> [!CAUTION]
>
> Paragraph 1
>
> Paragraph 2
| <- markup.quote.alert.caution.markdown punctuation.definition.blockquote.markdown
|^ markup.quote.alert.caution.markdown - markup.paragraph
| ^^^^^^^^^^^ markup.quote.alert.caution.markdown markup.paragraph.markdown
> [!CAUTION]
>
> - list item
>
> - list item
| <- markup.quote.alert.caution.markdown punctuation.definition.blockquote.markdown
|^ markup.quote.alert.caution.markdown
| ^ markup.quote.alert.caution.markdown markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown
| ^^^^^^^^^^^ markup.quote.alert.caution.markdown markup.list.unnumbered.markdown
> [!CAUTION]
>
> 1. list item
>
> 2. list item
| <- markup.quote.alert.caution.markdown punctuation.definition.blockquote.markdown
|^ markup.quote.alert.caution.markdown
| ^^ markup.quote.alert.caution.markdown markup.list.numbered.bullet.markdown
| ^ punctuation.definition.list_item.markdown
| ^^^^^^^^^^ markup.quote.alert.caution.markdown markup.list.numbered.markdown
> [!CAUTION]
>
> 1. list item
>
> 2. list item paragraph 1
>
> list item paragraph 2
| <- markup.quote.alert.caution.markdown markup.list.numbered.markdown punctuation.definition.blockquote.markdown
|^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.quote.alert.caution.markdown markup.list.numbered.markdown
> [!CAUTION]
>
> Paragraph 1
>
> # Heading
>
> Paragraph 2
| <- markup.quote.alert.caution.markdown punctuation.definition.blockquote.markdown
|^^^^^^^^^^^^^ markup.quote.alert.caution.markdown
> [!CAUTION]
>
> ```
> fenced code
> ```
>
> Paragraph 2
| <- markup.quote.alert.caution.markdown punctuation.definition.blockquote.markdown
|^^^^^^^^^^^^^ markup.quote.alert.caution.markdown
> [!WARNING]
| <- markup.quote.alert.warning.markdown punctuation.definition.blockquote.markdown
|^^^^^^^^^^^^ markup.quote.alert.warning.markdown
Expand Down Expand Up @@ -8281,6 +8341,66 @@ This is a [[wiki link]].
|^ markup.quote.alert.caution.markdown - markup.paragraph
| ^^^^^ markup.quote.alert.caution.markdown markup.paragraph.markdown
> [!CAUTION]
>
> Paragraph 1
>
> Paragraph 2
| <- markup.quote.alert.caution.markdown punctuation.definition.blockquote.markdown
|^ markup.quote.alert.caution.markdown - markup.paragraph
| ^^^^^^^^^^^ markup.quote.alert.caution.markdown markup.paragraph.markdown
> [!CAUTION]
>
> - list item
>
> - list item
| <- markup.quote.alert.caution.markdown punctuation.definition.blockquote.markdown
|^ markup.quote.alert.caution.markdown
| ^ markup.quote.alert.caution.markdown markup.list.unnumbered.bullet.markdown punctuation.definition.list_item.markdown
| ^^^^^^^^^^^ markup.quote.alert.caution.markdown markup.list.unnumbered.markdown
> [!CAUTION]
>
> 1. list item
>
> 2. list item
| <- markup.quote.alert.caution.markdown punctuation.definition.blockquote.markdown
|^ markup.quote.alert.caution.markdown
| ^^ markup.quote.alert.caution.markdown markup.list.numbered.bullet.markdown
| ^ punctuation.definition.list_item.markdown
| ^^^^^^^^^^ markup.quote.alert.caution.markdown markup.list.numbered.markdown
> [!CAUTION]
>
> 1. list item
>
> 2. list item paragraph 1
>
> list item paragraph 2
| <- markup.quote.alert.caution.markdown markup.list.numbered.markdown punctuation.definition.blockquote.markdown
|^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.quote.alert.caution.markdown markup.list.numbered.markdown
> [!CAUTION]
>
> Paragraph 1
>
> # Heading
>
> Paragraph 2
| <- markup.quote.alert.caution.markdown punctuation.definition.blockquote.markdown
|^^^^^^^^^^^^^ markup.quote.alert.caution.markdown
> [!CAUTION]
>
> ```
> fenced code
> ```
>
> Paragraph 2
| <- markup.quote.alert.caution.markdown punctuation.definition.blockquote.markdown
|^^^^^^^^^^^^^ markup.quote.alert.caution.markdown
1. list item
> [!WARNING]
| <- markup.quote.alert.warning.markdown punctuation.definition.blockquote.markdown
Expand Down

0 comments on commit 888cb19

Please sign in to comment.