/usr/share/doc/python-markdown-doc/docs/extensions/code_hilite.html is in python-markdown-doc 2.5.1-2.
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 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 | <!DOCTYPE html>
<html>
<head>
<meta charset=utf-8>
<title>CodeHilite 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="header_id.html" title="HeaderId Extension"
accesskey="N">next</a> |</li>
<li class="right">
<a href="admonition.html" title="Admonition 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.5.1 documentation</a> »</li>
<li><a href="index.html">Extensions</a> »</li>
<li><a href="code_hilite.html">CodeHilite Extension</a> »</li>
</ul>
</div> <!-- .related -->
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<h1 id="codehilite">CodeHilite<a class="headerlink" href="#codehilite" title="Permanent link">¶</a></h1>
<h2 id="summary">Summary<a class="headerlink" href="#summary" title="Permanent link">¶</a></h2>
<p>The CodeHilite extension adds code/syntax highlighting to standard
Python-Markdown code blocks using <a href="http://pygments.org/">Pygments</a>.</p>
<p>This extension is included in the standard Markdown library.</p>
<h2 id="setup">Setup<a class="headerlink" href="#setup" title="Permanent link">¶</a></h2>
<p>You will also need to <a href="http://pygments.org/download/">download</a> and install the Pygments package on your
<code>PYTHONPATH</code>. You will need to determine the appropriate CSS classes and create
appropriate rules for them, which are either defined in or linked from the
header of your HTML templates. See the excellent <a href="http://pygments.org/docs">documentation</a> for more
details. If no language is defined, Pygments will attempt to guess the
language. When that fails, the code block will display as un-highlighted code.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>The css and/or javascript is not included as part of this extension
but must be provided by the end user. The Pygments project provides
default css styles which you may find to be a useful starting point.</p>
</div>
<h2 id="syntax">Syntax<a class="headerlink" href="#syntax" title="Permanent link">¶</a></h2>
<p>The CodeHilite extension follows the same <a href="http://daringfireball.net/projects/markdown/syntax#precode">syntax</a> as regular Markdown code
blocks, with one exception. The hiliter needs to know what language to use for
the code block. There are three ways to tell the hiliter what language the code
block contains and each one has a different result.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>The format of the language identifier only effects the display of line numbers
if <code>linenums</code> is set to <code>None</code> (the default). If set to <code>True</code> or <code>False</code>
(see <a href="#usage">Usage</a> below) the format of the identifier has no effect on the
display of line numbers – it only serves as a means to define the language
of the code block.</p>
</div>
<h3 id="shebang-with-path">SheBang (with path)<a class="headerlink" href="#shebang-with-path" title="Permanent link">¶</a></h3>
<p>If the first line of the codeblock contains a shebang, the language is derived
from that and line numbers are used.</p>
<pre><code> #!/usr/bin/python
# Code goes here ...
</code></pre>
<p>Will result in:</p>
<pre><code>#!/usr/bin/python
# Code goes here ...
</code></pre>
<h3 id="shebang-no-path">SheBang (no path)<a class="headerlink" href="#shebang-no-path" title="Permanent link">¶</a></h3>
<p>If the first line contains a shebang, but the shebang line does not contain a
path (a single <code>/</code> or even a space), then that line is removed from the code
block before processing. Line numbers are used.</p>
<pre><code> #!python
# Code goes here ...
</code></pre>
<p>Will result in:</p>
<pre><code># Code goes here ...
</code></pre>
<h3 id="colons">Colons<a class="headerlink" href="#colons" title="Permanent link">¶</a></h3>
<p>If the first line begins with three or more colons, the text following the
colons identifies the language. The first line is removed from the code block
before processing and line numbers are not used.</p>
<pre><code> :::python
# Code goes here ...
</code></pre>
<p>Will result in:</p>
<pre><code># Code goes here ...
</code></pre>
<p>Certain lines can be selected for emphasis with the colon syntax. When
using Pygments’ default css styles, emphasized lines have a yellow background.
This is useful to direct the reader’s attention to specific lines.</p>
<pre><code>:::python hl_lines="1 3"
# This line is emphasized
# This line isn't
# This line is emphasized
</code></pre>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p><code>hl_lines</code> is named for Pygments’ option meaning “highlighted lines”.</p>
</div>
<h3 id="when-no-language-is-defined">When No Language is Defined<a class="headerlink" href="#when-no-language-is-defined" title="Permanent link">¶</a></h3>
<p>CodeHilite is completely backwards compatible so that if a code block is
encountered that does not define a language, the block is simply wrapped in
<code><pre></code> tags and output. </p>
<pre><code> # Code goes here ...
</code></pre>
<p>Will result in:</p>
<pre><code># Code goes here ...
</code></pre>
<p>Lets see the source for that:</p>
<pre><code><div class="codehilite"><pre><code># Code goes here ...
</code></pre></div>
</code></pre>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>When no language is defined, the Pygments highlighting engine will try to guess
the language (unless <code>guess_lang</code> is set to <code>False</code>). Upon failure, the same
behavior will happen as described above.</p>
</div>
<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.codehilite</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 following options are provided to configure the output:</p>
<ul>
<li>
<p><strong><code>linenums</code></strong>:
Use line numbers. Possible values are <code>True</code> for yes, <code>False</code> for no and
<code>None</code> for auto. Defaults to <code>None</code>.</p>
<p>Using <code>True</code> will force every code block to have line numbers, even when
using colons (<code>:::</code>) for language identification.</p>
<p>Using <code>False</code> will turn off all line numbers, even when using SheBangs
(<code>#!</code>) for language identification.</p>
</li>
<li>
<p><strong><code>guess_lang</code></strong>:
Automatic language detection. Defaults to <code>True</code>.</p>
<p>Using <code>False</code> will prevent Pygments from guessing the language, and thus
highlighting blocks only when you explicitly set the language.</p>
</li>
<li>
<p><strong><code>css_class</code></strong>:
Set CSS class name for the wrapper <code><div></code> tag. Defaults to
<code>codehilite</code>.</p>
</li>
<li>
<p><strong><code>pygments_style</code></strong>:
Pygments HTML Formatter Style (ColorScheme). Defaults to <code>default</code>.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>This is useful only when <code>noclasses</code> is set to <code>True</code>, otherwise the
CSS styles must be provided by the end user.</p>
</div>
</li>
<li>
<p><strong><code>noclasses</code></strong>:
Use inline styles instead of CSS classes. Defaults to <code>False</code>.</p>
</li>
</ul>
</div> <!-- .body -->
</div> <!-- .bodywrapper -->
</div> <!-- .documentwrapper -->
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h3>Table Of Contents</h3>
<div class="toc">
<ul>
<li><a href="#codehilite">CodeHilite</a><ul>
<li><a href="#summary">Summary</a></li>
<li><a href="#setup">Setup</a></li>
<li><a href="#syntax">Syntax</a><ul>
<li><a href="#shebang-with-path">SheBang (with path)</a></li>
<li><a href="#shebang-no-path">SheBang (no path)</a></li>
<li><a href="#colons">Colons</a></li>
<li><a href="#when-no-language-is-defined">When No Language is Defined</a></li>
</ul>
</li>
<li><a href="#usage">Usage</a></li>
</ul>
</li>
</ul>
</div>
<h4>Previous topic</h4>
<p class="topless"><a href="admonition.html"
title="previous chapter">Admonition Extension</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="header_id.html"
title="next chapter">HeaderId Extension</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="https://github.com/waylan/Python-Markdown/issues"
>Report a Bug</a></li>
<li><a href="code_hilite.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="header_id.html" title="HeaderId Extension"
accesskey="N">next</a> |</li>
<li class="right">
<a href="admonition.html" title="Admonition 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.5.1 documentation</a> »</li>
<li><a href="index.html">Extensions</a> »</li>
<li><a href="code_hilite.html">CodeHilite Extension</a> »</li>
</ul>
</div> <!-- .related -->
<div class="footer">© 2010-2012 Python Markdown Project</div>
</body>
</html>
|