diff options
author | Colin Watson <cjwatson@debian.org> | 2018-02-22 14:15:07 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2018-02-22 14:15:07 +0000 |
commit | 6037043e01b2a096d39883f9f7dd27cdcfe8d0ab (patch) | |
tree | 042485ea3a0d01f52c44fba7f2825798f8faab6c /pygments/lexers/markup.py | |
parent | 0db8e281af377923115b894703b2b8beb8f1e9d5 (diff) | |
download | pygments-6037043e01b2a096d39883f9f7dd27cdcfe8d0ab.tar.gz |
Markdown: add support for reference-style links
Diffstat (limited to 'pygments/lexers/markup.py')
-rw-r--r-- | pygments/lexers/markup.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/pygments/lexers/markup.py b/pygments/lexers/markup.py index 92dc9e7a..6b104bbe 100644 --- a/pygments/lexers/markup.py +++ b/pygments/lexers/markup.py @@ -583,6 +583,11 @@ class MarkdownLexer(RegexLexer): (r'[@#][\w/:]+', Name.Entity), # (image?) links eg: ![Image of Yaktocat](https://octodex.github.com/images/yaktocat.png) (r'(!?\[)([^]]+)(\])(\()([^)]+)(\))', bygroups(Text, Name.Tag, Text, Text, Name.Attribute, Text)), + # reference-style links, e.g.: + # [an example][id] + # [id]: http://example.com/ + (r'(\[)([^]]+)(\])(\[)([^]]*)(\])', bygroups(Text, Name.Tag, Text, Text, Name.Label, Text)), + (r'^(\s*\[)([^]]*)(\]:\s*)(.+)', bygroups(Text, Name.Label, Text, Name.Attribute)), # general text, must come last! (r'[^\\\s]+', Text), |