MCPcopy Index your code
hub / github.com/Python-Markdown/markdown / FootnoteTreeprocessor

Class FootnoteTreeprocessor

markdown/extensions/footnotes.py:407–427  ·  view source on GitHub ↗

Build and append footnote div to end of document.

Source from the content-addressed store, hash-verified

405
406
407class FootnoteTreeprocessor(Treeprocessor):
408 """ Build and append footnote div to end of document. """
409
410 def __init__(self, footnotes: FootnoteExtension):
411 self.footnotes = footnotes
412
413 def run(self, root: etree.Element) -> None:
414 footnotesDiv = self.footnotes.makeFootnotesDiv(root)
415 if footnotesDiv is not None:
416 result = self.footnotes.findFootnotesPlaceholder(root)
417 if result:
418 child, parent, isText = result
419 ind = list(parent).index(child)
420 if isText:
421 parent.remove(child)
422 parent.insert(ind, footnotesDiv)
423 else:
424 parent.insert(ind + 1, footnotesDiv)
425 child.tail = None
426 else:
427 root.append(footnotesDiv)
428
429
430class FootnoteReorderingProcessor(Treeprocessor):

Callers 1

extendMarkdownMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…