/usr/share/doc/python-markdown-doc/docs/extensions/fenced_code_blocks.txt 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 | title: Fenced Code Blocks Extension
prev_title: Definition Lists Extension
prev_url: definition_lists.html
next_title: Footnotes Extension
next_url: footnotes.html
Fenced Code Blocks
==================
Summary
-------
The Fenced Code Blocks extension adds a secondary way to define code blocks,
which overcomes a few limitations of the indented code blocks.
This extension is included in the standard Markdown library.
Syntax
------
Fenced Code Blocks are defined using the syntax established in
[PHP Markdown Extra][php].
[php]: http://www.michelf.com/projects/php-markdown/extra/#fenced-code-blocks
Thus, the following text (taken from the above referenced PHP documentation):
This is a paragraph introducing:
~~~~~~~~~~~~~~~~~~~~
a one-line code block
~~~~~~~~~~~~~~~~~~~~
Fenced code blocks can have a blank line as the first and/or last line of a
code block and they can also come immediately after a list item without becoming
part of the list.
!!! warning
Fenced Code Blocks are only supported at the document root level.
Therefore, they cannot be nested inside lists or blockquotes.
### Language ###
In addition to PHP Extra's syntax, you can define the language of the code
block for use by syntax highlighters etc. The language will be assigned as a
class attribute of the ``<code>`` element in the output. Therefore, you should
define the language as you would a css class - ``.language``. For consistency
with other markdown syntax, the language can *optionally* be wrapped in curly
brackets:
~~~~{.python}
# python code
~~~~
~~~~.html
<p>HTML Document</p>
~~~~
The above will output:
<pre><code class="python"># python code
</code></pre>
<pre><code class="html"><p>HTML Document</p>
</code></pre>
[Github][]'s backtick (`\``) syntax is also supported:
```python
# more python code
```
[Github]: http://github.github.com/github-flavored-markdown/
### Emphasized Lines ###
If you would like to have your fenced code blocks highlighted with the
[CodeHilite][] extension, simply enable that extension (remember that
[Pygments][] is its dependency) and the language of your fenced code blocks
will be passed in and highlighted appropriately.
Similar to the [colon][] syntax of the CodeHilite extension, fenced code blocks
can also have emphasized certain lines of code.
The lines can be specified with PHP Extra's syntax:
~~~~{.python hl_lines="1 3"}
# This line is emphasized
# This line isn't
# This line is emphasized
~~~~
... or with GitHub's:
```python hl_lines="1 3"
# This line is emphasized
# This line isn't
# This line is emphasized
```
[CodeHilite]: code_hilite.html
[Pygments]: http://pygments.org/
[colon]: code_hilite.html#colons
Usage
-----
See [Extensions](index.html) for general extension usage, specify `markdown.extensions.fenced_code`
as the name of the extension.
This extension does not accept any special configuration options.
|