-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use syntect to properly process links
- Loading branch information
1 parent
02aa380
commit 79717c2
Showing
6 changed files
with
87 additions
and
35 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
%YAML 1.2 | ||
--- | ||
# http://www.sublimetext.com/docs/3/syntax.html | ||
name: LinkHighlight | ||
file_extensions: | ||
- link_highlight | ||
scope: text.highlighting | ||
contexts: | ||
main: | ||
- match: (<)((?:https?|ftp)://.*?)(>) | ||
scope: meta.link.inet.markdown | ||
captures: | ||
1: punctuation.definition.link.begin.markdown | ||
2: markup.underline.link.markdown | ||
3: punctuation.definition.link.end.markdown | ||
- match: (((https|http|ftp)://)|www\.)[\w-]+(\.[\w-]+)+ | ||
scope: markup.underline.link.markdown | ||
push: # After a valid domain, zero or more non-space non-< characters may follow | ||
- match: (?=[?!.,:*_~]*[\s<]) # Trailing punctuation (specifically, ?, !, ., ,, :, *, _, and ~) will not be considered part of the autolink, though they may be included in the interior of the link | ||
pop: true | ||
- match: (?={{html_entity}}[?!.,:*_~]*[\s<]) # If an autolink ends in a semicolon (;), we check to see if it appears to resemble an entity reference; if the preceding text is & followed by one or more alphanumeric characters. If so, it is excluded from the autolink | ||
pop: true | ||
- match: \( # When an autolink ends in ), we scan the entire autolink for the total number of parentheses. If there is a greater number of closing parentheses than opening ones, we don’t consider the last character part of the autolink, in order to facilitate including an autolink inside a parenthesis | ||
push: | ||
- meta_scope: markup.underline.link.markdown | ||
- match: (?=[?!.,:*_~]*[\s<]) | ||
pop: true | ||
- match: \) | ||
pop: true | ||
- match: (?=\)[?!.,:*_~]*[\s<]) | ||
pop: true | ||
- match: '[^?!.,:*_~\s<&()]+|\S' | ||
scope: markup.underline.link.markdown |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters