Current File : //usr/share/doc/python2-markdown-2.4.1/extensions/extra.html |
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8>
<title>Extra 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="abbreviations.html" title="Abreviations Extension"
accesskey="N">next</a> |</li>
<li class="right">
<a href="index.html" title="Extensions"
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.4.1 documentation</a> »</li>
<li><a href="index.html">Extensions</a> »</li>
<li><a href="extra.html">Extra Extension</a> »</li>
</ul>
</div> <!-- .related -->
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<h1 id="python-markdown-extra">Python-Markdown Extra<a class="headerlink" href="#python-markdown-extra" title="Permanent link">¶</a></h1>
<h2 id="summary">Summary<a class="headerlink" href="#summary" title="Permanent link">¶</a></h2>
<p>A compilation of various Python-Markdown extensions that (mostly) imitates
<a href="http://michelf.com/projects/php-markdown/extra/">PHP Markdown Extra</a>.</p>
<p>The supported extensions include:</p>
<ul>
<li><a href="abbreviations.html">Abbreviations</a></li>
<li><a href="attr_list.html">Attribute Lists</a></li>
<li><a href="definition_lists.html">Definition Lists</a></li>
<li><a href="fenced_code_blocks.html">Fenced Code Blocks</a></li>
<li><a href="footnotes.html">Footnotes</a></li>
<li><a href="tables.html">Tables</a></li>
<li><a href="smart_strong.html">Smart Strong</a></li>
</ul>
<p>See each individual extension for syntax documentation. Extra and all its
supported extensions are included in the standard Markdown library.</p>
<h2 id="usage">Usage<a class="headerlink" href="#usage" title="Permanent link">¶</a></h2>
<p>From the Python interpreter:</p>
<pre><code>>>> import markdown
>>> html = markdown.markdown(text, ['extra'])
</code></pre>
<p>There may be <a href="index.html">additional extensions</a> that are distributed with
Python-Markdown that are not included here in Extra. The features
of those extensions are not part of PHP Markdown Extra, and
therefore, not part of Python-Markdown Extra. If you really would
like Extra to include additional extensions, we suggest creating
your own clone of Extra under a different name
(see the <a href="api.html">Extension API</a>). </p>
<h2 id="markdown-inside-html-blocks">Markdown Inside HTML Blocks<a class="headerlink" href="#markdown-inside-html-blocks" title="Permanent link">¶</a></h2>
<p>Unlike the other Extra features, this feature is built into the markdown core and is turned on when <code>extra</code> is enabled.</p>
<p>The content of any raw html block element can be Markdown-formatted simply by adding a <code>markdown</code> attribute to the opening tag. The markdown attribute will be stripped from the output, but all other attributes will be preserved.</p>
<p>If the markdown value is set to <code>1</code> (recommended) or any value other than <code>span</code> or <code>block</code>, the default behavior will be executed: <code>p</code>,<code>h[1-6]</code>,<code>li</code>,<code>dd</code>,<code>dt</code>,<code>td</code>,<code>th</code>,<code>legend</code>, and <code>address</code> elements skip block parsing while others do not. If the default is overrident by a value of <code>span</code>, <em>block parsing will be skipped</em> regardless of tag. If the default is overriden by a value of <code>block</code>, <em>block parsing will occur</em> regardless of tag.</p>
<h4 id="simple-example">Simple Example:<a class="headerlink" href="#simple-example" title="Permanent link">¶</a></h4>
<pre><code>This is *true* markdown text.
<div markdown="1">
This is *true* markdown text.
</div>
</code></pre>
<h4 id="result">Result:<a class="headerlink" href="#result" title="Permanent link">¶</a></h4>
<pre><code><p>This is <em>true</em> markdown text.</p>
<div>
<p>This is <em>true</em> markdown text.</p>
</div>
</code></pre>
<h3 id="nested-markdown-inside-html-blocks">Nested Markdown Inside HTML BLocks<a class="headerlink" href="#nested-markdown-inside-html-blocks" title="Permanent link">¶</a></h3>
<p>Nested elements are more sensitive and must be used cautiously. To avoid unexpected results:</p>
<ul>
<li>Only nest elements within block mode elements.</li>
<li>Follow the closing tag of inner elements with a blank line.</li>
<li>Only have one level of nesting.</li>
</ul>
<h4 id="complex-example">Complex Example:<a class="headerlink" href="#complex-example" title="Permanent link">¶</a></h4>
<pre><code><div markdown="1" name="Example">
The text of the `Example` element.
<div markdown="1" name="DefaultBlockMode">
This text gets wrapped in `p` tags.
</div>
The tail of the `DefaultBlockMode` subelement.
<p markdown="1" name="DefaultSpanMode">
This text *is not* wrapped in additional `p` tags.
</p>
The tail of the `DefaultSpanMode` subelement.
<div markdown="span" name="SpanModeOverride">
This `div` block is not wrapped in paragraph tags.
Note: Subelements are not required to have tail text.
</div>
<p markdown="block" name="BlockModeOverride">
This `p` block *is* foolishly wrapped in further paragraph tags.
</p>
The tail of the `BlockModeOverride` subelement.
<div name="RawHtml">
Raw html blocks may also be nested.
</div>
</div>
This text is after the markdown in html.
</code></pre>
<h4 id="result_1">Result:<a class="headerlink" href="#result_1" title="Permanent link">¶</a></h4>
<pre><code><div name="Example">
<p>The text of the <code>Example</code> element.</p>
<div name="DefaultBlockMode">
<p>This text gets wrapped in <code>p</code> tags.</p>
</div>
<p>The tail of the <code>DefaultBlockMode</code> subelement.</p>
<p name="DefaultSpanMode">
This text <em>is not</em> wrapped in additional <code>p</code> tags.</p>
<p>The tail of the <code>DefaultSpanMode</code> subelement.</p>
<div name="SpanModeOverride">
This <code>div</code> block is not wrapped in paragraph tags.
Note: Subelements are not required to have tail text.</div>
<p name="BlockModeOverride">
<p>This <code>p</code> block <em>is</em> foolishly wrapped in further paragraph tags.</p>
</p>
<p>The tail of the <code>BlockModeOverride</code> subelement.</p>
<div name="RawHtml">
Raw html blocks may also be nested.
</div>
</div>
<p>This text is after the markdown in html.</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="#python-markdown-extra">Python-Markdown Extra</a><ul>
<li><a href="#summary">Summary</a></li>
<li><a href="#usage">Usage</a></li>
<li><a href="#markdown-inside-html-blocks">Markdown Inside HTML Blocks</a><ul>
<li><a href="#simple-example">Simple Example:</a></li>
<li><a href="#result">Result:</a></li>
<li><a href="#nested-markdown-inside-html-blocks">Nested Markdown Inside HTML BLocks</a><ul>
<li><a href="#complex-example">Complex Example:</a></li>
<li><a href="#result_1">Result:</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<h4>Previous topic</h4>
<p class="topless"><a href="index.html"
title="previous chapter">Extensions</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="abbreviations.html"
title="next chapter">Abreviations 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="extra.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="abbreviations.html" title="Abreviations Extension"
accesskey="N">next</a> |</li>
<li class="right">
<a href="index.html" title="Extensions"
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.4.1 documentation</a> »</li>
<li><a href="index.html">Extensions</a> »</li>
<li><a href="extra.html">Extra Extension</a> »</li>
</ul>
</div> <!-- .related -->
<div class="footer">© 2010-2012 Python Markdown Project</div>
</body>
</html>