Skip to content
Open
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
10 changes: 10 additions & 0 deletions markdown.tmLanguage.base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ repository:
- {include: '#link-ref'}
- {include: '#link-ref-literal'}
- {include: '#link-ref-shortcut'}
- {include: '#link-html'}
ampersand:
comment: "Markdown will convert this for us. We match it so that the HTML grammar will not mark it up as invalid."
match: '&(?!([a-zA-Z0-9]+|#[0-9]+|#x[0-9a-fA-F]+);)'
Expand Down Expand Up @@ -291,6 +292,7 @@ repository:
- {include: '#link-ref-literal'}
- {include: '#link-ref'}
- {include: '#link-ref-shortcut'}
- {include: '#link-html'}
bracket:
comment: "Markdown will convert this for us. We match it so that the HTML grammar will not mark it up as invalid."
match: '<(?![a-zA-Z/?\$!])'
Expand Down Expand Up @@ -406,6 +408,7 @@ repository:
- {include: '#link-ref-literal'}
- {include: '#link-ref'}
- {include: '#link-ref-shortcut'}
- {include: '#link-html'}
link-email:
captures:
'1': {name: punctuation.definition.link.markdown}
Expand Down Expand Up @@ -480,6 +483,13 @@ repository:
'3': {name: punctuation.definition.string.end.markdown}
match: (\[)(\S+?)(\])
name: meta.link.reference.markdown
link-html:
captures:
'1': {name: punctuation.definition.link.markdown}
'2': {name: markup.underline.link.markdown}
'3': {name: punctuation.definition.link.markdown}
match: (?<=\[.*\]\()(\<)(.*?)(\>)
name: meta.link.inline.markdown
raw:
captures:
'1': {name: punctuation.definition.raw.markdown}
Expand Down
37 changes: 37 additions & 0 deletions syntaxes/markdown.tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -3764,6 +3764,10 @@
<key>include</key>
<string>#link-ref-shortcut</string>
</dict>
<dict>
<key>include</key>
<string>#link-html</string>
</dict>
</array>
</dict>
<key>ampersand</key>
Expand Down Expand Up @@ -3902,6 +3906,10 @@
<key>include</key>
<string>#link-ref-shortcut</string>
</dict>
<dict>
<key>include</key>
<string>#link-html</string>
</dict>
</array>
</dict>
<key>bracket</key>
Expand Down Expand Up @@ -4193,6 +4201,10 @@
<key>include</key>
<string>#link-ref-shortcut</string>
</dict>
<dict>
<key>include</key>
<string>#link-html</string>
</dict>
</array>
</dict>
<key>link-email</key>
Expand Down Expand Up @@ -4453,6 +4465,31 @@
<key>name</key>
<string>meta.link.reference.markdown</string>
</dict>
<key>link-html</key>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.link.markdown</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>markup.underline.link.markdown</string>
</dict>
<key>3</key>
<dict>
<key>name</key>
<string>punctuation.definition.link.markdown</string>
</dict>
</dict>
<key>match</key>
<string>(?&lt;=\[.*\]\()(\&lt;)(.*?)(\&gt;)</string>
<key>name</key>
<string>meta.link.inline.markdown</string>
</dict>
<key>raw</key>
<dict>
<key>captures</key>
Expand Down
5 changes: 5 additions & 0 deletions test/colorize-fixtures/issue-80.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[text](link)

[text](<link>)

[title](<path with spaces>)
233 changes: 233 additions & 0 deletions test/colorize-results/issue-80_md.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,233 @@
[
{
"c": "[",
"t": "text.html.markdown meta.paragraph.markdown meta.link.inline.markdown punctuation.definition.string.begin.markdown",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "text",
"t": "text.html.markdown meta.paragraph.markdown meta.link.inline.markdown string.other.link.title.markdown",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "string: #CE9178"
}
},
{
"c": "]",
"t": "text.html.markdown meta.paragraph.markdown meta.link.inline.markdown punctuation.definition.string.end.markdown",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "(",
"t": "text.html.markdown meta.paragraph.markdown meta.link.inline.markdown punctuation.definition.metadata.markdown",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "link",
"t": "text.html.markdown meta.paragraph.markdown meta.link.inline.markdown markup.underline.link.markdown",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": ")",
"t": "text.html.markdown meta.paragraph.markdown meta.link.inline.markdown punctuation.definition.metadata.markdown",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "[",
"t": "text.html.markdown meta.paragraph.markdown meta.link.inline.markdown punctuation.definition.string.begin.markdown",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "text",
"t": "text.html.markdown meta.paragraph.markdown meta.link.inline.markdown string.other.link.title.markdown",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "string: #CE9178"
}
},
{
"c": "]",
"t": "text.html.markdown meta.paragraph.markdown meta.link.inline.markdown punctuation.definition.string.end.markdown",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "(",
"t": "text.html.markdown meta.paragraph.markdown meta.link.inline.markdown punctuation.definition.metadata.markdown",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "<",
"t": "text.html.markdown meta.paragraph.markdown meta.link.inline.markdown punctuation.definition.link.markdown",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "link>",
"t": "text.html.markdown meta.paragraph.markdown meta.link.inline.markdown markup.underline.link.markdown",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": ")",
"t": "text.html.markdown meta.paragraph.markdown meta.link.inline.markdown punctuation.definition.metadata.markdown",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "[",
"t": "text.html.markdown meta.paragraph.markdown meta.link.reference.markdown punctuation.definition.string.begin.markdown",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "title",
"t": "text.html.markdown meta.paragraph.markdown meta.link.reference.markdown string.other.link.title.markdown",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "string: #CE9178"
}
},
{
"c": "]",
"t": "text.html.markdown meta.paragraph.markdown meta.link.reference.markdown punctuation.definition.string.end.markdown",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "(",
"t": "text.html.markdown meta.paragraph.markdown",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "<",
"t": "text.html.markdown meta.paragraph.markdown meta.link.inline.markdown punctuation.definition.link.markdown",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": "path with spaces",
"t": "text.html.markdown meta.paragraph.markdown meta.link.inline.markdown markup.underline.link.markdown",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": ">",
"t": "text.html.markdown meta.paragraph.markdown meta.link.inline.markdown punctuation.definition.link.markdown",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
},
{
"c": ")",
"t": "text.html.markdown meta.paragraph.markdown",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF"
}
}
]