diff options
author | Waylan Limberg <waylan@gmail.com> | 2011-08-02 09:23:49 -0400 |
---|---|---|
committer | Waylan Limberg <waylan@gmail.com> | 2011-08-02 09:23:49 -0400 |
commit | 7af553173629d8d8e36e71fbf2753dc8d6fe11d3 (patch) | |
tree | b9f2460776fe98511f3c713b5ae5fd5b3899bfaf /markdown/extensions/headerid.py | |
parent | 447e238186f30f3480afadb68aaf5efa4f6dfc9e (diff) | |
download | markdown-7af553173629d8d8e36e71fbf2753dc8d6fe11d3.tar.gz markdown-7af553173629d8d8e36e71fbf2753dc8d6fe11d3.tar.bz2 markdown-7af553173629d8d8e36e71fbf2753dc8d6fe11d3.zip |
Added doctests to fabfile and edited them to pass in all supported versions of python. Note: one test (meta) is still failing on Python 3 due to unicode strings.
Diffstat (limited to 'markdown/extensions/headerid.py')
-rw-r--r-- | markdown/extensions/headerid.py | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/markdown/extensions/headerid.py b/markdown/extensions/headerid.py index 42e82b0..b0e37e2 100644 --- a/markdown/extensions/headerid.py +++ b/markdown/extensions/headerid.py @@ -11,8 +11,8 @@ Basic usage: >>> import markdown >>> text = "# Some Header #" >>> md = markdown.markdown(text, ['headerid']) - >>> md - u'<h1 id="some-header">Some Header</h1>' + >>> print md + <h1 id="some-header">Some Header</h1> All header IDs are unique: @@ -21,8 +21,10 @@ All header IDs are unique: ... #Header ... #Header''' >>> md = markdown.markdown(text, ['headerid']) - >>> md - u'<h1 id="header">Header</h1>\\n<h1 id="header_1">Header</h1>\\n<h1 id="header_2">Header</h1>' + >>> print md + <h1 id="header">Header</h1> + <h1 id="header_1">Header</h1> + <h1 id="header_2">Header</h1> To fit within a html template's hierarchy, set the header base level: @@ -30,15 +32,16 @@ To fit within a html template's hierarchy, set the header base level: ... #Some Header ... ## Next Level''' >>> md = markdown.markdown(text, ['headerid(level=3)']) - >>> md - u'<h3 id="some-header">Some Header</h3>\\n<h4 id="next-level">Next Level</h4>' + >>> print md + <h3 id="some-header">Some Header</h3> + <h4 id="next-level">Next Level</h4> Works with inline markup. >>> text = '#Some *Header* with [markup](http://example.com).' >>> md = markdown.markdown(text, ['headerid']) - >>> md - u'<h1 id="some-header-with-markup">Some <em>Header</em> with <a href="http://example.com">markup</a>.</h1>' + >>> print md + <h1 id="some-header-with-markup">Some <em>Header</em> with <a href="http://example.com">markup</a>.</h1> Turn off auto generated IDs: @@ -46,8 +49,9 @@ Turn off auto generated IDs: ... # Some Header ... # Another Header''' >>> md = markdown.markdown(text, ['headerid(forceid=False)']) - >>> md - u'<h1>Some Header</h1>\\n<h1>Another Header</h1>' + >>> print md + <h1>Some Header</h1> + <h1>Another Header</h1> Use with MetaData extension: @@ -56,8 +60,8 @@ Use with MetaData extension: ... ... # A Header''' >>> md = markdown.markdown(text, ['headerid', 'meta']) - >>> md - u'<h2>A Header</h2>' + >>> print md + <h2>A Header</h2> Copyright 2007-2011 [Waylan Limberg](http://achinghead.com/). |