From 5ad00fab5d0942e8ff2b264e81db82ced75261a5 Mon Sep 17 00:00:00 2001 From: Waylan Limberg Date: Tue, 30 Dec 2014 11:16:20 -0500 Subject: Always add toc to Markdown Class Instance Previously, we only added the toc attribute (md.toc) if no Marker was found within the document. However, that has caused framworks to do things like force insert a marker, run convert, then extract the toc from the body of the document. This is much cleaner. And if the user wants to add the toc to the document also, they still can. --- markdown/extensions/toc.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/markdown/extensions/toc.py b/markdown/extensions/toc.py index db6659c..b3bab93 100644 --- a/markdown/extensions/toc.py +++ b/markdown/extensions/toc.py @@ -200,12 +200,12 @@ class TocTreeprocessor(Treeprocessor): prettify = self.markdown.treeprocessors.get('prettify') if prettify: prettify.run(div) - if not marker_found: - # serialize and attach to markdown instance. - toc = self.markdown.serializer(div) - for pp in self.markdown.postprocessors.values(): - toc = pp.run(toc) - self.markdown.toc = toc + + # serialize and attach to markdown instance. + toc = self.markdown.serializer(div) + for pp in self.markdown.postprocessors.values(): + toc = pp.run(toc) + self.markdown.toc = toc class TocExtension(Extension): -- cgit v1.2.3