Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Markdown] support lists in blockquotes, code fences, multiline inline code and multiline emphasis #806

Merged
merged 30 commits into from
Mar 21, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
97eb093
[Markdown] Block quote simplification
keith-hall Feb 12, 2017
7a60853
[Markdown] to interrupt a paragraph, an ordered list must begin with 1
keith-hall Feb 12, 2017
8a6ae59
[Markdown] support lists in blockquotes and codeblocks in lists
keith-hall Feb 12, 2017
b568304
[Markdown] support HTML in list items
keith-hall Feb 12, 2017
41f6fd8
[Markdown] scope the exclamation mark punctuation that begins an image
keith-hall Feb 13, 2017
f1cd1a0
[Markdown] use variable for link title regex
keith-hall Feb 13, 2017
4aac501
[Markdown] add begin and end scopes plus more tests
keith-hall Feb 13, 2017
a6a00a5
[Markdown] support inline code and nested square brackets in link text
keith-hall Feb 13, 2017
706278f
[Markdown] remove more incompatible regexs
keith-hall Feb 13, 2017
77533c2
[Markdown] escaping backticks inside inline code is not possible
keith-hall Feb 13, 2017
5ec0bc3
[Markdown] add more tests
keith-hall Feb 13, 2017
faed126
[Markdown] remove lookbehinds, add tests
keith-hall Feb 13, 2017
06e33bb
[Markdown] remove backreferences
keith-hall Feb 13, 2017
367afa2
[Markdown] more lookbehinds removed
keith-hall Feb 13, 2017
4abd6fb
[Markdown] more tests
keith-hall Feb 13, 2017
dd62000
[Markdown] inline code improvements
keith-hall Feb 13, 2017
3441944
[Markdown] support code fences
keith-hall Feb 14, 2017
588d4dc
[Markdown] support multi-line inline code
keith-hall Feb 14, 2017
77a7317
[Markdown] final incompatible regex patterns removed
keith-hall Feb 14, 2017
efa843e
[Markdown] allow emphasis to end/start inside nested HTML tags
keith-hall Feb 14, 2017
515910b
[Markdown] Add comment about target implementation compatibility
keith-hall Feb 16, 2017
2846d9c
[Markdown] make context and variable names match CommonMark spec
keith-hall Feb 21, 2017
5900db7
[Markdown] a couple more hard line break test assertions
keith-hall Feb 21, 2017
1878944
[Markdown] support multi-line emphasis
keith-hall Feb 21, 2017
71f671d
[Markdown] allow thematic breaks to be highlighted in list items
keith-hall Feb 21, 2017
867b093
[Markdown] support emphasis in link text
keith-hall Feb 21, 2017
6724234
[Markdown] allow HTML and images inside links
keith-hall Feb 22, 2017
ab3355d
[Markdown] support multi line link titles
keith-hall Feb 22, 2017
24785e6
[Markdown] more tests for deeply nested list items
keith-hall Feb 22, 2017
33bda54
[Markdown] better (non) code fence handling
keith-hall Feb 22, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 16 additions & 11 deletions Markdown/Markdown.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ variables:
escape: '\\[-`*_#+.!(){}\[\]\\>]'
backticks: |-
(?x:
(`{4})([^`]+|`(?!`{3}))+(`{4})
| (`{3})([^`]+|`(?!`{2}))+(`{3})
| (`{2})([^`]+|`(?!`{1}))+(`{2})
| (`{1})([^`]+ )+(`{1})
(`{4})[^`]+(?:[^`]+|(?!`{4})`*)*(`{4})(?!`)
| (`{3})[^`]+(?:[^`]+|(?!`{3})`*)*(`{3})(?!`)
| (`{2})[^`]+(?:[^`]+|(?!`{2})`*)*(`{2})(?!`)
| (`{1})[^`]+(?:[^`]+|(?!`{1})`*)*(`{1})(?!`)
)
balance: |-
(?x:
Expand Down Expand Up @@ -643,13 +643,18 @@ contexts:
- include: inline-bold-italic-linebreak
- include: scope:text.html.basic
raw:
- 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: '{{backticks}}'
Copy link
Collaborator

@FichteFoll FichteFoll Feb 13, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest this instead:

contexts:
  raw:
    - 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

This allows multi-line inline raw sequences again and isn't explicit about the number of backticks allowed, which is arbitrary. I don't know if this actually represents how markdown parsers work, but some testing here on github seemed to confirm this behavior.

Should also exit on empty lines. See:

test `test

test`

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@FichteFoll thanks, I have just pushed a new commit with your proposal :)

scope: markup.raw.inline.markdown
captures:
1: punctuation.definition.raw.begin.markdown
2: punctuation.definition.raw.end.markdown
3: punctuation.definition.raw.begin.markdown
4: punctuation.definition.raw.end.markdown
5: punctuation.definition.raw.begin.markdown
6: punctuation.definition.raw.end.markdown
7: punctuation.definition.raw.begin.markdown
8: punctuation.definition.raw.end.markdown
- match: '`+'
separator:
- match: '{{separator_line}}\n?'
scope: meta.separator.markdown
Expand Down
7 changes: 7 additions & 0 deletions Markdown/syntax_test_markdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -504,3 +504,10 @@ _test <span>text **formatted**</span>_
| ^^ punctuation
| ^ punctuation
| ^ punctuation
```testing``123```
| <- punctuation.definition.raw.begin
| ^^ - punctuation
| ^^^ punctuation.definition.raw.end
```testing``123````
| <- - punctuation
| ^^^^^^^^^^^^^^^^^ - punctuation