Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,30 @@ repository:
patterns:
- name: meta.snippet.section.markdown
match: >-
(?:^|\G)(.*?)(?<!;)(-{1,}8<-{1,})([ \t]+)(\[)([ \t]*)(?i:(start|end))([ \t]*)(:)([ \t]*)([a-z][-_0-9a-z]*)([ \t]*)(\])(.*)$
(?:^|\G)([ \t]*)(<!--)([ \t]+)(-{1,}8<-{1,})([ \t]+)(\[)([ \t]*)(?i:(start|end))([ \t]*)(:)([ \t]*)([a-z][-_0-9a-z]*)([ \t]*)(\])([ \t]+)(-->)([ \t]*)$
captures:
1:
name: meta.snippet.section.prefix.markdown
patterns:
- include: "#inline_flow"
1: { name: punctuation.whitespace.leading.markdown }
2: { name: punctuation.definition.comment.begin.html }
3: { name: punctuation.whitespace.markdown }
4: { name: keyword.control.snippet.markdown }
5: { name: comment.snippet.separator.markdown }
6: { name: punctuation.definition.snippet-section.begin.markdown }
7: { name: punctuation.whitespace.markdown }
8: { name: keyword.control.snippet.section.markdown }
9: { name: punctuation.whitespace.markdown }
10: { name: punctuation.separator.snippet-section.markdown }
11: { name: punctuation.whitespace.markdown }
12: { name: entity.name.section.snippet.markdown }
13: { name: punctuation.whitespace.markdown }
14: { name: punctuation.definition.snippet-section.end.markdown }
15: { name: punctuation.whitespace.markdown }
16: { name: punctuation.definition.comment.end.html }
17: { name: punctuation.whitespace.trailing.markdown }
- name: meta.snippet.section.markdown
match: >-
(?:^|\G)([ \t]*)(-{1,}8<-{1,})([ \t]+)(\[)([ \t]*)(?i:(start|end))([ \t]*)(:)([ \t]*)([a-z][-_0-9a-z]*)([ \t]*)(\])([ \t]*)$
captures:
1: { name: punctuation.whitespace.leading.markdown }
2: { name: keyword.control.snippet.markdown }
3: { name: comment.snippet.separator.markdown }
4: { name: punctuation.definition.snippet-section.begin.markdown }
Expand All @@ -67,10 +85,7 @@ repository:
10: { name: entity.name.section.snippet.markdown }
11: { name: punctuation.whitespace.markdown }
12: { name: punctuation.definition.snippet-section.end.markdown }
13:
name: meta.snippet.section.suffix.markdown
patterns:
- include: "#inline_flow"
13: { name: punctuation.whitespace.trailing.markdown }
- name: meta.snippet.inline.markdown
match: >-
(?:^|\G)([ \t]*)(-{1,}8<-{1,})([ \t]+)(")((?:\\"|[^"\r\n])+?)((?::-?[0-9]*){1,2}(?:(?:,(?=[-0-9:])-?[0-9]*)(?::-?[0-9]*)?)*)(")$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -911,18 +911,10 @@
"tokens": []
}
],
"accept_with_prefix_and_suffix": [
"accept_uppercase_keyword": [
{
"line": "prefix --8<-- [start:example] suffix",
"line": "--8<-- [START:example]",
"tokens": [
{
"text": "prefix ",
"scopes": [
"text.html.markdown.python",
"meta.snippet.section.markdown",
"meta.snippet.section.prefix.markdown"
]
},
{
"text": "--8<--",
"scopes": [
Expand All @@ -948,7 +940,7 @@
]
},
{
"text": "start",
"text": "START",
"scopes": [
"text.html.markdown.python",
"meta.snippet.section.markdown",
Expand Down Expand Up @@ -978,14 +970,6 @@
"meta.snippet.section.markdown",
"punctuation.definition.snippet-section.end.markdown"
]
},
{
"text": " suffix",
"scopes": [
"text.html.markdown.python",
"meta.snippet.section.markdown",
"meta.snippet.section.suffix.markdown"
]
}
]
},
Expand All @@ -994,87 +978,28 @@
"tokens": []
}
],
"accept_uppercase_keyword": [
"accept_html_comment_wrapped": [
{
"line": "--8<-- [START:example]",
"line": "<!-- --8<-- [start:example] -->",
"tokens": [
{
"text": "--8<--",
"text": "<!--",
"scopes": [
"text.html.markdown.python",
"meta.snippet.section.markdown",
"keyword.control.snippet.markdown"
"punctuation.definition.comment.begin.html"
]
},
{
"text": " ",
"scopes": [
"text.html.markdown.python",
"meta.snippet.section.markdown",
"comment.snippet.separator.markdown"
]
},
{
"text": "[",
"scopes": [
"text.html.markdown.python",
"meta.snippet.section.markdown",
"punctuation.definition.snippet-section.begin.markdown"
]
},
{
"text": "START",
"scopes": [
"text.html.markdown.python",
"meta.snippet.section.markdown",
"keyword.control.snippet.section.markdown"
]
},
{
"text": ":",
"scopes": [
"text.html.markdown.python",
"meta.snippet.section.markdown",
"punctuation.separator.snippet-section.markdown"
]
},
{
"text": "example",
"scopes": [
"text.html.markdown.python",
"meta.snippet.section.markdown",
"entity.name.section.snippet.markdown"
]
},
{
"text": "]",
"scopes": [
"text.html.markdown.python",
"meta.snippet.section.markdown",
"punctuation.definition.snippet-section.end.markdown"
]
}
]
},
{
"line": "",
"tokens": []
}
],
"reject_escaped": [
{
"line": ";--8<-- [start:example]",
"tokens": [
{
"text": ";-",
"scopes": [
"text.html.markdown.python",
"meta.snippet.section.markdown",
"meta.snippet.section.prefix.markdown"
"punctuation.whitespace.markdown"
]
},
{
"text": "-8<--",
"text": "--8<--",
"scopes": [
"text.html.markdown.python",
"meta.snippet.section.markdown",
Expand Down Expand Up @@ -1128,6 +1053,22 @@
"meta.snippet.section.markdown",
"punctuation.definition.snippet-section.end.markdown"
]
},
{
"text": " ",
"scopes": [
"text.html.markdown.python",
"meta.snippet.section.markdown",
"punctuation.whitespace.markdown"
]
},
{
"text": "-->",
"scopes": [
"text.html.markdown.python",
"meta.snippet.section.markdown",
"punctuation.definition.comment.end.html"
]
}
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,20 +118,14 @@ index.md
--8<-- [end:example]
```

### accept_with_prefix_and_suffix

``` md
prefix --8<-- [start:example] suffix
```

### accept_uppercase_keyword

``` md
--8<-- [START:example]
```

### reject_escaped
### accept_html_comment_wrapped

``` md
;--8<-- [start:example]
<!-- --8<-- [start:example] -->
```
73 changes: 60 additions & 13 deletions integrations/code/syntaxes/python-markdown.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,67 @@
"patterns": [
{
"name": "meta.snippet.section.markdown",
"match": "(?:^|\\G)(.*?)(?<!;)(-{1,}8<-{1,})([ \\t]+)(\\[)([ \\t]*)(?i:(start|end))([ \\t]*)(:)([ \\t]*)([a-z][-_0-9a-z]*)([ \\t]*)(\\])(.*)$",
"match": "(?:^|\\G)([ \\t]*)(<!--)([ \\t]+)(-{1,}8<-{1,})([ \\t]+)(\\[)([ \\t]*)(?i:(start|end))([ \\t]*)(:)([ \\t]*)([a-z][-_0-9a-z]*)([ \\t]*)(\\])([ \\t]+)(-->)([ \\t]*)$",
"captures": {
"1": {
"name": "meta.snippet.section.prefix.markdown",
"patterns": [
{
"include": "#inline_flow"
}
]
"name": "punctuation.whitespace.leading.markdown"
},
"2": {
"name": "punctuation.definition.comment.begin.html"
},
"3": {
"name": "punctuation.whitespace.markdown"
},
"4": {
"name": "keyword.control.snippet.markdown"
},
"5": {
"name": "comment.snippet.separator.markdown"
},
"6": {
"name": "punctuation.definition.snippet-section.begin.markdown"
},
"7": {
"name": "punctuation.whitespace.markdown"
},
"8": {
"name": "keyword.control.snippet.section.markdown"
},
"9": {
"name": "punctuation.whitespace.markdown"
},
"10": {
"name": "punctuation.separator.snippet-section.markdown"
},
"11": {
"name": "punctuation.whitespace.markdown"
},
"12": {
"name": "entity.name.section.snippet.markdown"
},
"13": {
"name": "punctuation.whitespace.markdown"
},
"14": {
"name": "punctuation.definition.snippet-section.end.markdown"
},
"15": {
"name": "punctuation.whitespace.markdown"
},
"16": {
"name": "punctuation.definition.comment.end.html"
},
"17": {
"name": "punctuation.whitespace.trailing.markdown"
}
}
},
{
"name": "meta.snippet.section.markdown",
"match": "(?:^|\\G)([ \\t]*)(-{1,}8<-{1,})([ \\t]+)(\\[)([ \\t]*)(?i:(start|end))([ \\t]*)(:)([ \\t]*)([a-z][-_0-9a-z]*)([ \\t]*)(\\])([ \\t]*)$",
"captures": {
"1": {
"name": "punctuation.whitespace.leading.markdown"
},
"2": {
"name": "keyword.control.snippet.markdown"
Expand Down Expand Up @@ -91,12 +143,7 @@
"name": "punctuation.definition.snippet-section.end.markdown"
},
"13": {
"name": "meta.snippet.section.suffix.markdown",
"patterns": [
{
"include": "#inline_flow"
}
]
"name": "punctuation.whitespace.trailing.markdown"
}
}
},
Expand Down