aboutsummaryrefslogtreecommitdiffstats
path: root/docs/extensions
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2009-03-20 21:33:23 -0400
committerWaylan Limberg <waylan@gmail.com>2009-03-20 21:33:23 -0400
commit834d1a8afe8236d60a994c649e453a650e7594a9 (patch)
treef4782cd1b1fb71aa7501283212e00efe6a437b24 /docs/extensions
parenta5669823d377ca252a84e28a329c30758995f3da (diff)
downloadmarkdown-834d1a8afe8236d60a994c649e453a650e7594a9.tar.gz
markdown-834d1a8afe8236d60a994c649e453a650e7594a9.tar.bz2
markdown-834d1a8afe8236d60a994c649e453a650e7594a9.zip
Fixed a few bugs in wikilinks url cleaning. And for those who don't like the default, added a config which accepts a callable to replace the default. Updated tests and docs.
Diffstat (limited to 'docs/extensions')
-rw-r--r--docs/extensions/WikiLinks.txt16
1 files changed, 16 insertions, 0 deletions
diff --git a/docs/extensions/WikiLinks.txt b/docs/extensions/WikiLinks.txt
index 73991cf..36045cb 100644
--- a/docs/extensions/WikiLinks.txt
+++ b/docs/extensions/WikiLinks.txt
@@ -63,6 +63,8 @@ change the default behavior:
Default: `'wikilink'`
+4. **build_url**: Callable which formats the URL from it's parts.
+
For an example, let us suppose links should always point to the subdirectory
`/wiki/` and end with `.html`
@@ -74,6 +76,20 @@ The above would result in the following link for `[[WikiLink]]`.
<a href="/wiki/WikiLink.html" class="wikilink">WikiLink</a>
+If you want to do more that just alter the base and/or end of the URL, you
+could also pass in a callable which must accept three arguments (``label``,
+``base``, and ``end``). The callable must return the URL in it's entirety.
+
+ def my_url_builder(label, base, end):
+ # do stuff
+ return url
+
+ md = markdown.Markdown(
+ extensions=['wikilinks],
+ extension_configs={'wikilinks' : ('build_url', my_url_builder)}
+ )
+
+
The option is also provided to change or remove the class attribute.
>>> html = markdown.markdown(text,