From 3a89552f92584bae149fb08531a42e414736a6f2 Mon Sep 17 00:00:00 2001 From: Steve Losh Date: Fri, 25 Dec 2009 14:44:47 -0500 Subject: Fix the TOC extension for TOCs starting at levels other than 1. --- markdown/extensions/toc.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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: -- cgit v1.2.3