aboutsummaryrefslogtreecommitdiffstats
path: root/docs/extensions
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2013-02-19 11:00:38 -0500
committerWaylan Limberg <waylan@gmail.com>2013-02-19 11:00:38 -0500
commite5e07c3746358fc70afc2e5b0344a5e7573b444a (patch)
tree5124591a538876a7a1f9eea31a3eb39b5cde5ad8 /docs/extensions
parent53a7fc80f12cc1da699c2a7f56da13da32e6de8f (diff)
downloadmarkdown-e5e07c3746358fc70afc2e5b0344a5e7573b444a.tar.gz
markdown-e5e07c3746358fc70afc2e5b0344a5e7573b444a.tar.bz2
markdown-e5e07c3746358fc70afc2e5b0344a5e7573b444a.zip
Ensure toc attribute is available on Markdown class.
This appears to have recently been broken with the fixes in #191. This time I've added tests to prevent future breakage and added documentation to explain the behavior.
Diffstat (limited to 'docs/extensions')
-rw-r--r--docs/extensions/toc.txt21
1 files changed, 19 insertions, 2 deletions
diff --git a/docs/extensions/toc.txt b/docs/extensions/toc.txt
index 632294b..af282c6 100644
--- a/docs/extensions/toc.txt
+++ b/docs/extensions/toc.txt
@@ -40,8 +40,12 @@ would generate the following output:
<h1 id="header-1">Header 1</h1>
<h1 id="header-2">Header 2</h1>
-Configuration Options
----------------------
+Usage
+-----
+
+From the Python interpreter:
+
+ >>> html = markdown.markdown(some_text, extensions=['toc'])
The following options are provided to configure the output:
@@ -54,3 +58,16 @@ The following options are provided to configure the output:
* **title**: Title to insert in TOC ``<div>``. Defaults to ``None``.
* **anchorlink**: Set to ``True`` to have the headers link to themselves.
Default is ``False``.
+
+If a 'marker' is not found in the document, then the toc is available as an
+attribute of the Markdown class. This allows one to insert the toc elsewhere
+in their page template. For example:
+
+ >>> text = '''
+ # Header 1
+
+ ## Header 2
+ '''
+ >>> md = markdown.Markdown(extensions=['toc'])
+ >>> html = md.convert(text)
+ >>> render_some_template(context={'body': html, 'toc': md.toc})