From aedcfd85a4ac46e2b9c3fa33cf8899a1159c99f7 Mon Sep 17 00:00:00 2001 From: luxcem Date: Mon, 29 Feb 2016 17:11:49 +0100 Subject: [PATCH] modified: markdown/extensions/wikilinks.py Adds unrestricted regex for title because the current regex doesn't allow the large variety of titles on wikipedia. Adds the labeled links syntax from wikipedia : [[a|b]] is labeled "b" on this page but links to page "a". --- markdown/extensions/wikilinks.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/markdown/extensions/wikilinks.py b/markdown/extensions/wikilinks.py index 94e1b6794..9db602d71 100644 --- a/markdown/extensions/wikilinks.py +++ b/markdown/extensions/wikilinks.py @@ -45,7 +45,7 @@ def extendMarkdown(self, md, md_globals): self.md = md # append to end of inline patterns - WIKILINK_RE = r'\[\[([\w0-9_ -]+)\]\]' + WIKILINK_RE = r'\[\[(.*?)(\|(.*?))?\]\]' wikilinkPattern = WikiLinks(WIKILINK_RE, self.getConfigs()) wikilinkPattern.md = md md.inlinePatterns.add('wikilink', wikilinkPattern, "