Skip to content

Commit

Permalink
[Markdown] Fix ATX heading
Browse files Browse the repository at this point in the history
This commit enforces at least one whitespace after a hashtag to match
a token as atx heading.

see: markedjs/marked#201
  • Loading branch information
deathaxe committed May 13, 2021
1 parent f996a6f commit f657ed8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Markdown/Markdown.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ variables:
)
setext_escape: ^(?=\s{0,3}(?:---+|===+)\s*$)
block_quote: (?:[ ]{,3}>(?:.|$)) # between 0 and 3 spaces, followed by a greater than sign, followed by any character or the end of the line
atx_heading: (?:[#]{1,6}\s*) # between 1 and 6 hashes, followed by any amount of whitespace
atx_heading: (?:[#]{1,6}\s+) # between 1 and 6 hashes, followed by any amount of whitespace
indented_code_block: (?:[ ]{4}|\t) # 4 spaces or a tab
list_item: (?:[ ]{,3}(?=\d+\.|[*+-])\d*([*+.-])\s) # between 0 and 3 spaces, followed by either: at least one integer and a full stop, or (a star, plus or dash), followed by whitespace
escape: '\\[-`*_#+.!(){}\[\]\\>|~<]'
Expand Down
4 changes: 4 additions & 0 deletions Markdown/syntax_test_markdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ http://spec.commonmark.org/0.28/#example-44
|^^^^^^^^^^^^^^^^^^^^^^ markup.heading
| ^ - punctuation.definition.heading.end.markdown

#NotAHeading
| <- - markup.heading
|^^^^^^^^^^^^ - markup.heading

Alternate Heading
| <- markup.heading.1
=================
Expand Down

0 comments on commit f657ed8

Please sign in to comment.