diff options
author | Waylan Limberg <waylan@gmail.com> | 2009-03-18 23:29:40 -0400 |
---|---|---|
committer | Waylan Limberg <waylan@gmail.com> | 2009-03-18 23:29:40 -0400 |
commit | 70c81659eca814bb037b93c95996210d192e5ca5 (patch) | |
tree | 20b523620683e1d3efc30c3049e8a3ea2d9a7eb0 /docs/extensions/Fenced_Code_Blocks.txt | |
parent | e4508b2a767e0679bca71086890998d5e328517d (diff) | |
download | markdown-70c81659eca814bb037b93c95996210d192e5ca5.tar.gz markdown-70c81659eca814bb037b93c95996210d192e5ca5.tar.bz2 markdown-70c81659eca814bb037b93c95996210d192e5ca5.zip |
Added documentation for Extra Extension and all the extentions it supports. Still need to do non-extra extensions.
Diffstat (limited to 'docs/extensions/Fenced_Code_Blocks.txt')
-rw-r--r-- | docs/extensions/Fenced_Code_Blocks.txt | 63 |
1 files changed, 63 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..6b1ba76 --- /dev/null +++ b/docs/extensions/Fenced_Code_Blocks.txt @@ -0,0 +1,63 @@ +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']) + + + |