Current File : //usr/share/doc/python2-markdown-2.4.1/extensions/extra.html
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8>
<title>Extra Extension &#8212; 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> &raquo;</li>
    <li><a href="index.html">Extensions</a> &raquo;</li>
<li><a href="extra.html">Extra Extension</a> &raquo;</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">&para;</a></h1>
<h2 id="summary">Summary<a class="headerlink" href="#summary" title="Permanent link">&para;</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">&para;</a></h2>
<p>From the Python interpreter:</p>
<pre><code>&gt;&gt;&gt; import markdown
&gt;&gt;&gt; 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">&para;</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">&para;</a></h4>
<pre><code>This is *true* markdown text.

&lt;div markdown=&quot;1&quot;&gt;
This is *true* markdown text.
&lt;/div&gt;
</code></pre>

<h4 id="result">Result:<a class="headerlink" href="#result" title="Permanent link">&para;</a></h4>
<pre><code>&lt;p&gt;This is &lt;em&gt;true&lt;/em&gt; markdown text.&lt;/p&gt;
&lt;div&gt;
&lt;p&gt;This is &lt;em&gt;true&lt;/em&gt; markdown text.&lt;/p&gt;
&lt;/div&gt;
</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">&para;</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">&para;</a></h4>
<pre><code>&lt;div markdown=&quot;1&quot; name=&quot;Example&quot;&gt;

The text of the `Example` element.

&lt;div markdown=&quot;1&quot; name=&quot;DefaultBlockMode&quot;&gt;
This text gets wrapped in `p` tags.
&lt;/div&gt;

The tail of the `DefaultBlockMode` subelement.

&lt;p markdown=&quot;1&quot; name=&quot;DefaultSpanMode&quot;&gt;
This text *is not* wrapped in additional `p` tags.
&lt;/p&gt;

The tail of the `DefaultSpanMode` subelement.

&lt;div markdown=&quot;span&quot; name=&quot;SpanModeOverride&quot;&gt;
This `div` block is not wrapped in paragraph tags.
Note: Subelements are not required to have tail text.
&lt;/div&gt;

&lt;p markdown=&quot;block&quot; name=&quot;BlockModeOverride&quot;&gt;
This `p` block *is* foolishly wrapped in further paragraph tags.
&lt;/p&gt;

The tail of the `BlockModeOverride` subelement.

&lt;div name=&quot;RawHtml&quot;&gt;
Raw html blocks may also be nested.
&lt;/div&gt;

&lt;/div&gt;

This text is after the markdown in html.
</code></pre>

<h4 id="result_1">Result:<a class="headerlink" href="#result_1" title="Permanent link">&para;</a></h4>
<pre><code>&lt;div name=&quot;Example&quot;&gt;
&lt;p&gt;The text of the &lt;code&gt;Example&lt;/code&gt; element.&lt;/p&gt;
&lt;div name=&quot;DefaultBlockMode&quot;&gt;
&lt;p&gt;This text gets wrapped in &lt;code&gt;p&lt;/code&gt; tags.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;The tail of the &lt;code&gt;DefaultBlockMode&lt;/code&gt; subelement.&lt;/p&gt;
&lt;p name=&quot;DefaultSpanMode&quot;&gt;
This text &lt;em&gt;is not&lt;/em&gt; wrapped in additional &lt;code&gt;p&lt;/code&gt; tags.&lt;/p&gt;
&lt;p&gt;The tail of the &lt;code&gt;DefaultSpanMode&lt;/code&gt; subelement.&lt;/p&gt;
&lt;div name=&quot;SpanModeOverride&quot;&gt;
This &lt;code&gt;div&lt;/code&gt; block is not wrapped in paragraph tags.
Note: Subelements are not required to have tail text.&lt;/div&gt;
&lt;p name=&quot;BlockModeOverride&quot;&gt;
&lt;p&gt;This &lt;code&gt;p&lt;/code&gt; block &lt;em&gt;is&lt;/em&gt; foolishly wrapped in further paragraph tags.&lt;/p&gt;
&lt;/p&gt;
&lt;p&gt;The tail of the &lt;code&gt;BlockModeOverride&lt;/code&gt; subelement.&lt;/p&gt;
&lt;div name=&quot;RawHtml&quot;&gt;
Raw html blocks may also be nested.
&lt;/div&gt;

&lt;/div&gt;
&lt;p&gt;This text is after the markdown in html.&lt;/p&gt;
</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> &raquo;</li>
    <li><a href="index.html">Extensions</a> &raquo;</li>
<li><a href="extra.html">Extra Extension</a> &raquo;</li>
  </ul>
</div> <!-- .related -->

<div class="footer">&copy; 2010-2012 Python Markdown Project</div>
</body>
</html>