diff options
-rw-r--r-- | docs/extensions/WikiLinks.txt | 2 | ||||
-rw-r--r-- | markdown/extensions/wikilinks.py | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/docs/extensions/WikiLinks.txt b/docs/extensions/WikiLinks.txt index 36045cb..8bbead5 100644 --- a/docs/extensions/WikiLinks.txt +++ b/docs/extensions/WikiLinks.txt @@ -86,7 +86,7 @@ could also pass in a callable which must accept three arguments (``label``, md = markdown.Markdown( extensions=['wikilinks], - extension_configs={'wikilinks' : ('build_url', my_url_builder)} + extension_configs={'wikilinks' : [('build_url', my_url_builder)]} ) diff --git a/markdown/extensions/wikilinks.py b/markdown/extensions/wikilinks.py index feb55b3..df44e1c 100644 --- a/markdown/extensions/wikilinks.py +++ b/markdown/extensions/wikilinks.py @@ -56,6 +56,15 @@ MetaData should not carry over to next document: >>> md.convert("No [[MetaData]] here.") u'<p>No <a class="wikilink" href="/MetaData/">MetaData</a> here.</p>' +Define a custom URL builder: + + >>> def my_url_builder(label, base, end): + ... return '/bar/' + >>> md = markdown.Markdown(extensions=['wikilinks'], + ... extension_configs={'wikilinks' : [('build_url', my_url_builder)]}) + >>> md.convert('[[foo]]') + u'<p><a class="wikilink" href="/bar/">foo</a></p>' + From the command line: python markdown.py -x wikilinks(base_url=http://example.com/,end_url=.html,html_class=foo) src.txt |