summaryrefslogtreecommitdiff
path: root/pygments/lexers
diff options
context:
space:
mode:
authorAnteru <bitbucket@ca.sh13.net>2019-04-01 15:16:47 +0000
committerAnteru <bitbucket@ca.sh13.net>2019-04-01 15:16:47 +0000
commit71e5476f3c7414c9845c07f43a0f4e03b256b27f (patch)
tree3a4991c2c954679cda03d3d2d60d4cde8536093c /pygments/lexers
parent366a92c61b78e59526e4ec3ca42d276fd90010c5 (diff)
parent6037043e01b2a096d39883f9f7dd27cdcfe8d0ab (diff)
downloadpygments-71e5476f3c7414c9845c07f43a0f4e03b256b27f.tar.gz
Merged in cjwatson/pygments-main (pull request #753)
Markdown: add support for reference-style links
Diffstat (limited to 'pygments/lexers')
-rw-r--r--pygments/lexers/markup.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/pygments/lexers/markup.py b/pygments/lexers/markup.py
index e6265f40..6eb55fc4 100644
--- a/pygments/lexers/markup.py
+++ b/pygments/lexers/markup.py
@@ -582,6 +582,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),