/usr/share/doc/python-markdown-doc/docs/extensions/wikilinks.html is in python-markdown-doc 2.6.9-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | <!DOCTYPE html>
<html>
<head>
<meta charset=utf-8>
<title>WikiLinks Extension — Python Markdown</title>
<link rel="stylesheet" href="../default.css" type="text/css">
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../siteindex.html" title="General Index">index</a></li>
<li class="right">
<a href="api.html" title="Extension API"
accesskey="N">next</a> |</li>
<li class="right">
<a href="toc.html" title="Table of Contents Extension"
accesskey="P">previous</a> |</li>
<li><img src="../py.png" alt=""
style="vertical-align: middle; margin-top: -1px"/></li>
<li><a href="../index.html">Python Markdown v2.6.9 documentation</a> »</li>
<li><a href="index.html">Extensions</a> »</li>
<li><a href="wikilinks.html">WikiLinks Extension</a> »</li>
</ul>
</div> <!-- .related -->
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<h1 id="wikilinks">WikiLinks<a class="headerlink" href="#wikilinks" title="Permanent link">¶</a></h1>
<h2 id="summary">Summary<a class="headerlink" href="#summary" title="Permanent link">¶</a></h2>
<p>The WikiLinks extension adds support for <a href="http://en.wikipedia.org/wiki/Wikilink">WikiLinks</a>. Specifically, any
<code>[[bracketed]]</code> word is converted to a link.</p>
<p>This extension is included in the standard Markdown library.</p>
<h2 id="syntax">Syntax<a class="headerlink" href="#syntax" title="Permanent link">¶</a></h2>
<p>A <code>[[bracketed]]</code> word is any combination of upper or lower case letters,
number, dashes, underscores and spaces surrounded by double brackets. Therefore</p>
<pre><code>[[Bracketed]]
</code></pre>
<p>would produce the following HTML:</p>
<pre><code><a href="/Bracketed/" class="wikilink">Bracketed</a>
</code></pre>
<p>Note that WikiLinks are automatically assigned <code>class="wikilink"</code> making it
easy to style WikiLinks differently from other links on a page if one so
desires. See below for ways to alter the class.</p>
<p>Also note that when a space is used, the space is converted to an underscore in
the link but left as-is in the label. Perhaps an example would illustrate this
best:</p>
<pre><code>[[Wiki Link]]
</code></pre>
<p>becomes</p>
<pre><code><a href="/Wiki_Link/" class="wikilink">Wiki Link</a>
</code></pre>
<h2 id="usage">Usage<a class="headerlink" href="#usage" title="Permanent link">¶</a></h2>
<p>See <a href="index.html">Extensions</a> for general extension usage, specify <code>markdown.extensions.wikilinks</code>
as the name of the extension.</p>
<p>See the <a href="../reference.html#extensions">Library Reference</a> for information about
configuring extensions.</p>
<p>The default behavior is to point each link to the document root of the current
domain and close with a trailing slash. Additionally, each link is assigned to
the HTML class <code>wikilink</code>.</p>
<p>The following options are provided to change the default behavior:</p>
<ul>
<li>
<p><strong><code>base_url</code></strong>: String to append to beginning of URL.</p>
<p>Default: <code>'/'</code></p>
</li>
<li>
<p><strong><code>end_url</code></strong>: String to append to end of URL.</p>
<p>Default: <code>'/'</code></p>
</li>
<li>
<p><strong><code>html_class</code></strong>: CSS class. Leave blank for none.</p>
<p>Default: <code>'wikilink'</code></p>
</li>
<li>
<p><strong><code>build_url</code></strong>: Callable which formats the URL from its parts.</p>
</li>
</ul>
<h3 id="examples">Examples<a class="headerlink" href="#examples" title="Permanent link">¶</a></h3>
<p>For an example, let us suppose links should always point to the sub-directory
<code>/wiki/</code> and end with <code>.html</code></p>
<pre><code>>>> from markdown.extensions.wikilinks import WikiLinkExtension
>>> html = markdown.markdown(text,
... extensions=[WikiLinkExtension(base_url='/wiki/', end_url='.html')]
... )
</code></pre>
<p>The above would result in the following link for <code>[[WikiLink]]</code>.</p>
<pre><code><a href="/wiki/WikiLink.html" class="wikilink">WikiLink</a>
</code></pre>
<p>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 (<code>label</code>,
<code>base</code>, and <code>end</code>). The callable must return the URL in it’s entirety.</p>
<pre><code>>>> def my_url_builder(label, base, end):
... # do stuff
... return url
...
>>> html = markdown.markdown(text,
... extensions=[WikiLinkExtension(build_url=my_url_builder)],
... )
</code></pre>
<p>The option is also provided to change or remove the class attribute.</p>
<pre><code>>>> html = markdown.markdown(text,
... extensions=[WikiLinkExtension(html_class='myclass')]
... )
</code></pre>
<p>Would cause all WikiLinks to be assigned to the class <code>myclass</code>.</p>
<pre><code><a href="/WikiLink/" class="myclass">WikiLink</a>
</code></pre>
<h2 id="using-with-meta-data-extension">Using with Meta-Data extension<a class="headerlink" href="#using-with-meta-data-extension" title="Permanent link">¶</a></h2>
<p>The WikiLink extension also supports the <a href="meta_data.html">Meta-Data</a> extension.
Please see the documentation for that extension for specifics. The supported
meta-data keywords are:</p>
<ul>
<li><code>wiki_base_url</code></li>
<li><code>wiki_end_url</code></li>
<li><code>wiki_html_class</code></li>
</ul>
<p>When used, the meta-data will override the settings provided through the
<code>extension_configs</code> interface.</p>
<p>This document:</p>
<pre><code>wiki_base_url: http://example.com/
wiki_end_url: .html
wiki_html_class:
A [[WikiLink]] in the first paragraph.
</code></pre>
<p>would result in the following output (notice the blank <code>wiki_html_class</code>):</p>
<pre><code><p>A <a href="http://example.com/WikiLink.html">WikiLink</a> in the first paragraph.</p>
</code></pre>
</div> <!-- .body -->
</div> <!-- .bodywrapper -->
</div> <!-- .documentwrapper -->
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h3>Table Of Contents</h3>
<div class="toc">
<ul>
<li><a href="#wikilinks">WikiLinks</a><ul>
<li><a href="#summary">Summary</a></li>
<li><a href="#syntax">Syntax</a></li>
<li><a href="#usage">Usage</a><ul>
<li><a href="#examples">Examples</a></li>
</ul>
</li>
<li><a href="#using-with-meta-data-extension">Using with Meta-Data extension</a></li>
</ul>
</li>
</ul>
</div>
<h4>Previous topic</h4>
<p class="topless"><a href="toc.html"
title="previous chapter">Table of Contents Extension</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="api.html"
title="next chapter">Extension API</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="https://github.com/Python-Markdown/markdown/issues"
>Report a Bug</a></li>
<li><a href="wikilinks.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div> <!-- .sphinxsidebarwrapper -->
</div> <!-- .sphinxsidebar -->
<div class="clearer"></div>
</div> <!-- .document -->
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../siteindex.html" title="General Index">index</a></li>
<li class="right">
<a href="api.html" title="Extension API"
accesskey="N">next</a> |</li>
<li class="right">
<a href="toc.html" title="Table of Contents Extension"
accesskey="P">previous</a> |</li>
<li><img src="../py.png" alt=""
style="vertical-align: middle; margin-top: -1px"/></li>
<li><a href="../index.html">Python Markdown v2.6.9 documentation</a> »</li>
<li><a href="index.html">Extensions</a> »</li>
<li><a href="wikilinks.html">WikiLinks Extension</a> »</li>
</ul>
</div> <!-- .related -->
<div class="footer">© 2010-2012 Python Markdown Project</div>
</body>
</html>
|