aboutsummaryrefslogtreecommitdiffstats
path: root/docs/extensions/toc.txt
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2014-02-16 08:53:16 -0500
committerWaylan Limberg <waylan@gmail.com>2014-02-16 08:53:16 -0500
commit9a03243ff51ce2e868cfd2de713d7de6ae84140e (patch)
tree9c81612ef756024dd205022d250fc65e2e11eb3a /docs/extensions/toc.txt
parentfefe904ca9175ab390a8a0868e810a41945cdd8f (diff)
parentaff7cabd5fa16daff866c06e056804d3f6f42500 (diff)
downloadmarkdown-9a03243ff51ce2e868cfd2de713d7de6ae84140e.tar.gz
markdown-9a03243ff51ce2e868cfd2de713d7de6ae84140e.tar.bz2
markdown-9a03243ff51ce2e868cfd2de713d7de6ae84140e.zip
Merge pull request #288 from lahwaacz/master
docs: improved documentation
Diffstat (limited to 'docs/extensions/toc.txt')
-rw-r--r--docs/extensions/toc.txt75
1 files changed, 44 insertions, 31 deletions
diff --git a/docs/extensions/toc.txt b/docs/extensions/toc.txt
index 260129c..d13aadb 100644
--- a/docs/extensions/toc.txt
+++ b/docs/extensions/toc.txt
@@ -1,7 +1,7 @@
title: Table of Contents Extension
prev_title: SmartyPants Extension
prev_url: smarty.html
-next_title: Wikilinks Extension
+next_title: WikiLinks Extension
next_url: wikilinks.html
Table of Contents
@@ -10,16 +10,17 @@ Table of Contents
Summary
-------
-Adds a Table of Contents to a Markdown document.
+The Table of Contents extension generates a Table of Contents from a Markdown
+document and adds it into the resulting HTML document.
-This extension is included with the Markdown library since version 2.0.
+This extension is included in the standard Markdown library.
Syntax
------
-Place a marker in the document where you would like the table of contents to
+Place a marker in the document where you would like the Table of Contents to
appear. Then, a nested list of all the headers in the document will replace the
-marker. The marker defaults to ``[TOC]`` so the following document:
+marker. The marker defaults to `[TOC]` so the following document:
[TOC]
@@ -43,33 +44,45 @@ would generate the following output:
Usage
-----
-From the Python interpreter:
+See [Extensions](index.html) for general extension usage, specify `toc`
+as the name of the extension.
- >>> html = markdown.markdown(some_text, extensions=['toc'])
+See the [Library Reference](../reference.html#extensions) for information about
+configuring extensions.
The following options are provided to configure the output:
-* **marker**: Text to find and replace with the Table of Contents. Defaults
- to ``[TOC]``.
-* **slugify**: Callable to generate anchors based on header text. Defaults to a
- built in ``slugify`` method. The callable must accept one argument which
- contains the text content of the header and return a string which will be
- used as the anchor text.
-* **title**: Title to insert in TOC ``<div>``. Defaults to ``None``.
-* **anchorlink**: Set to ``True`` to have the headers link to themselves.
- Default is ``False``.
-* **permalink**: Set to ``True`` to have this extension generate Sphinx-style
- permanent links near the headers (for use with Sphinx stylesheets).
-
-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})
+* **marker**:
+ Text to find and replace with the Table of Contents. Defaults
+ to `[TOC]`.
+
+ If a `marker` is not found in the document, then the Table of Contents is
+ available as an attribute of the Markdown class. This allows one to insert
+ the Table of Contents 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})
+
+* **slugify**:
+ Callable to generate anchors based on header text. Defaults to a built in
+ `slugify` method. The callable must accept one argument which contains the
+ text content of the header and return a string which will be used as the
+ anchor text.
+
+* **title**:
+ Title to insert in the Table of Contents' `<div>`. Defaults to `None`.
+
+* **anchorlink**:
+ Setting to `True` will cause the headers link to themselves. Default is
+ `False`.
+
+* **permalink**:
+ Set to `True` to have this extension generate a Sphinx-style permanent links
+ near the headers (for use with Sphinx stylesheets).
+