Skip to content

Commit

Permalink
[Markdown] Fix more arrow like ligatures
Browse files Browse the repository at this point in the history
Addresses MonoLisaFont/feedback#36

This commit extends the existing ligatures tokenization fix to match
more arrow like ligatures correctly, by just consuming everything, which
looks like a ligature candidate.
  • Loading branch information
deathaxe committed Aug 16, 2020
1 parent 0b498f9 commit d306a03
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 7 deletions.
13 changes: 10 additions & 3 deletions Markdown/Markdown.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ contexts:
pattern will only match stuff matched by the sub-patterns.
push:
- meta_scope: meta.block-level.markdown
- include: ligatures
- include: block-quote
- include: ligatures
- include: indented-code-block
- include: atx-heading
- include: thematic-break
Expand Down Expand Up @@ -364,9 +364,16 @@ contexts:
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: '<?(-+|=+)<' # -< --< ---< ----< <-< <--< <---< <----<
# =< ==< ===< ====< <=< <==< <===< <====<
- match: '<(-+|=+)>?' # <- <-- <--- <-> <--> <--->
# <= <== <=== <=> <==> <===>
- match: '>(-+|=+)[<>]?' # >- >-- >--- >-> >--> >---> >-< >--< >---<
# >= >== >=== >=> >==> >===> >=< >==< >===<
- match: '<<+|<>|>>+' # << <<< <<<< <> >>>> >>> >>

block-quote:
- match: '[ ]{,3}(>)[ ]?'
comment: |
Expand Down
40 changes: 36 additions & 4 deletions Markdown/syntax_test_markdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,9 @@ paragraph
>=
| ^^ - punctuation.definition.blockquote.markdown

>==
| <- punctuation.definition.blockquote.markdown

Code block below:

this is code!
Expand Down Expand Up @@ -503,11 +506,40 @@ a.b-c_d@a.b.
this is a raw ampersand & does not require HTML escaping
| ^ meta.other.valid-ampersand

this is a raw bracket < <= <- << does not require HTML escaping
this is a raw bracket < > does not require HTML escaping
| ^^^ - meta.tag
| ^ meta.other.valid-bracket
| ^^ - meta.other-valid-bracket - meta.tag
| ^^ - meta.other-valid-bracket - meta.tag
| ^^ - meta.other-valid-bracket - meta.tag
| ^ - meta.other.valid-bracket

these are raw ligatures << <<< <<<< <<<<< >>>>> >>>> >>> >>
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.other.valid-bracket - meta.tag

these are raw ligatures <- <-- <--- <---- <-< <--< <---< <----<
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.other.valid-bracket - meta.tag

these are raw ligatures -> --> ---> ----> >-> >--> >---> >---->
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.other.valid-bracket - meta.tag

these are raw ligatures >- >-- >--- >---- ----< ---< --< -<
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.other.valid-bracket - meta.tag

these are raw ligatures >< >-< >--< >---< <---> <--> <-> <>
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.other.valid-bracket - meta.tag

these are raw ligatures <= <== <=== <==== <=< <==< <===< <====<
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.other.valid-bracket - meta.tag

these are raw ligatures => ==> ===> ====> >=> >==> >===> >====>
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.other.valid-bracket - meta.tag

these are raw ligatures >= >== >=== >==== ====< ===< ==< =<
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.other.valid-bracket - meta.tag

these are raw ligatures >< >=< >==< >===< <===> <==> <=> <>
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.other.valid-bracket - meta.tag

these are raw ligatures - -- --- ---- ----- ===== ==== === == =
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - meta.other.valid-bracket - meta.tag

[2]: https://github.com/sublimehq/Packages "Packages Repo"
| <- meta.link.reference.def
Expand Down

0 comments on commit d306a03

Please sign in to comment.