aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Losh <steve@stevelosh.com>2009-12-25 14:44:47 -0500
committerSteve Losh <steve@stevelosh.com>2009-12-25 14:44:47 -0500
commit3a89552f92584bae149fb08531a42e414736a6f2 (patch)
tree6bbaf1589441c3b234efa0ea59e95a184c9e8242
parentf271d1766a9672fa9f7bee6f89e7c41171b25698 (diff)
downloadmarkdown-3a89552f92584bae149fb08531a42e414736a6f2.tar.gz
markdown-3a89552f92584bae149fb08531a42e414736a6f2.tar.bz2
markdown-3a89552f92584bae149fb08531a42e414736a6f2.zip
Fix the TOC extension for TOCs starting at levels other than 1.
-rw-r--r--markdown/extensions/toc.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/markdown/extensions/toc.py b/markdown/extensions/toc.py
index 1d9489c..fd2a86a 100644
--- a/markdown/extensions/toc.py
+++ b/markdown/extensions/toc.py
@@ -71,7 +71,10 @@ class TocTreeprocessor(markdown.treeprocessors.Treeprocessor):
else:
list_stack[-1].append(newlist)
list_stack.append(newlist)
- level += 1
+ if level == 0:
+ level = tag_level
+ else:
+ level += 1
# Do not override pre-existing ids
if not "id" in c.attrib: