Skip to content

Commit eaa3160

Browse files
author
Waylan Limberg
committed
Fixed Python-Markdown#73. Codehilite now works in footnotes.
The footnotes treeprocessor must be the first one run so that all others, including codehilite's, can run on the contents of the footnote div which is created and inserted by the footnotes treeprocessor. Thanks to startling for the report.
1 parent 67cee51 commit eaa3160

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

markdown/extensions/codehilite.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ def extendMarkdown(self, md, md_globals):
216216
""" Add HilitePostprocessor to Markdown instance. """
217217
hiliter = HiliteTreeprocessor(md)
218218
hiliter.config = self.getConfigs()
219-
md.treeprocessors.add("hilite", hiliter, "_begin")
219+
md.treeprocessors.add("hilite", hiliter, "<inline")
220220

221221
md.registerExtension(self)
222222

markdown/extensions/footnotes.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ def extendMarkdown(self, md, md_globals):
6969
md.inlinePatterns.add("footnote", FootnotePattern(FOOTNOTE_RE, self),
7070
"<reference")
7171
# Insert a tree-processor that would actually add the footnote div
72-
# This must be before the inline treeprocessor so inline patterns
73-
# run on the contents of the div.
72+
# This must be before all other treeprocessors (i.e., inline and
73+
# codehilite) so they can run on the the contents of the div.
7474
md.treeprocessors.add("footnote", FootnoteTreeprocessor(self),
75-
"<inline")
75+
"_begin")
7676
# Insert a postprocessor after amp_substitute oricessor
7777
md.postprocessors.add("footnote", FootnotePostprocessor(self),
7878
">amp_substitute")

0 commit comments

Comments
 (0)