aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaylan Limberg <waylan.limberg@icloud.com>2014-12-30 11:16:20 -0500
committerWaylan Limberg <waylan.limberg@icloud.com>2014-12-30 11:16:20 -0500
commit5ad00fab5d0942e8ff2b264e81db82ced75261a5 (patch)
tree2aa075f74eea920e11b925eb66bb23515fc5ddde
parent52b9f8c1ea191ce9c1ae0cd485306460cb52f71b (diff)
downloadmarkdown-5ad00fab5d0942e8ff2b264e81db82ced75261a5.tar.gz
markdown-5ad00fab5d0942e8ff2b264e81db82ced75261a5.tar.bz2
markdown-5ad00fab5d0942e8ff2b264e81db82ced75261a5.zip
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.
-rw-r--r--markdown/extensions/toc.py12
1 files 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):