From f920f0ec9e7d290d78f7991cce1c3308d7223f96 Mon Sep 17 00:00:00 2001 From: bas smit Date: Sat, 18 May 2013 20:36:55 +0200 Subject: [PATCH] Update the extract_toc documentation with a md/rst toc example --- extract_toc/README.md | 44 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/extract_toc/README.md b/extract_toc/README.md index 2cd826a..2dbc8bb 100644 --- a/extract_toc/README.md +++ b/extract_toc/README.md @@ -54,6 +54,50 @@ ToC generated by Markdown is enclosed in `
`. On the other hand ToC generated by reST is enclosed in `
`. `extract_toc` relies on this behavior to work. +reStructuredText Example +------------------------ + +To add a table of contents to your reStructuredText document you need to add a 'contents directive' at the place where you want the table of contents to appear. See the [documentation](http://docutils.sourceforge.net/docs/ref/rst/directives.html#table-of-contents) for more details. + +```rst +My super title +############## + +:date: 2010-10-03 +:tags: thats, awesome + +.. contents:: +.. + 1 Head 1 + 1.1 Head 2 + 2 Head 3 + 3 head 4 + +Heading 1 +--------- + +Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. +``` + +Markdown Example +---------------- + +To add a table of contents to your Markdown document you need to place the 'TOC marker' at the place where you would like the table of contents to appear. See the Python Markdown [documentation](http://pythonhosted.org/Markdown/extensions/toc.html) for more details. + +Important! To enable table of contents generation for the markdown reader you need to set `MD_EXTENSIONS = (['toc'])` in your pelican configuration file. + +```Markdown +title: My super title +date: 4-4-2013 +tags: thats, awesome + +[TOC] + +# Heading 1 # + +Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. +``` + Template Example ================