diff options
author | Waylan Limberg <waylan@gmail.com> | 2012-03-07 09:35:40 -0500 |
---|---|---|
committer | Waylan Limberg <waylan@gmail.com> | 2012-03-07 09:35:40 -0500 |
commit | ec46692cf5c4d5e22950bc8e7d14cb0ec327fb87 (patch) | |
tree | 9c1b9c5025948204e415a21938469bf50bbae754 /docs/extensions/fenced_code_blocks.txt | |
parent | 9fd4a5f1600c96406ad0fb86b1a8287d525972ac (diff) | |
download | markdown-ec46692cf5c4d5e22950bc8e7d14cb0ec327fb87.tar.gz markdown-ec46692cf5c4d5e22950bc8e7d14cb0ec327fb87.tar.bz2 markdown-ec46692cf5c4d5e22950bc8e7d14cb0ec327fb87.zip |
Rename docs/*.md => docs/*.txt
The documentation uses features of Python-Markdown that are not supported on
GitHub and it's better to get a source view of the docs anyway. For example,
that way comments and bug reports can reference a specific line of a file.
Of course, it makes sense for Github to render the README, so that is left
with the `.md` file extension.
Diffstat (limited to 'docs/extensions/fenced_code_blocks.txt')
-rw-r--r-- | docs/extensions/fenced_code_blocks.txt | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/docs/extensions/fenced_code_blocks.txt b/docs/extensions/fenced_code_blocks.txt new file mode 100644 index 0000000..0aa0d34 --- /dev/null +++ b/docs/extensions/fenced_code_blocks.txt @@ -0,0 +1,69 @@ +title: Fenced Code Block Extension +prev_title: Definition List Extension +prev_url: definition_lists.html +next_title: Footnotes Extension +next_url: footnotes.html + +Fenced Code Blocks +================== + +Summary +------- + +This 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. + +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> + +Usage +----- + +From the Python interpreter: + + >>> html = markdown.markdown(text, ['fenced_code']) + + + |