Register the processors. | Class Instance | Registry | Name | Priority | | --------------------------------------------------------------------------- | ----------
(self, md)
| 83 | self.reset() |
| 84 | |
| 85 | def extendMarkdown(self, md): |
| 86 | """ Register the processors. |
| 87 | |
| 88 | | Class Instance | Registry | Name | Priority | |
| 89 | | --------------------------------------------------------------------------- | ---------------------------------------------------------------- | ------ | :------: | |
| 90 | | [`FootnoteBlockProcessor`][markdown.extensions.footnotes.FootnoteBlockProcessor] | [`blockprocessors`][markdown.blockprocessors.build_block_parser] | `footnote` | `17` | |
| 91 | | [`FootnoteInlineProcessor`][markdown.extensions.footnotes.FootnoteInlineProcessor] | [`inlinepatterns`][markdown.inlinepatterns.build_inlinepatterns] | `footnote` | `175` | |
| 92 | | [`FootnoteTreeprocessor`][markdown.extensions.footnotes.FootnoteTreeprocessor] | [`treeprocessors`][markdown.treeprocessors.build_treeprocessors] | `footnote` | `50` | |
| 93 | | [`FootnoteReorderingProcessor`][markdown.extensions.footnotes.FootnoteReorderingProcessor] | [`treeprocessors`][markdown.treeprocessors.build_treeprocessors] | `footnote-reorder` | `19` | |
| 94 | | [`FootnotePostTreeprocessor`][markdown.extensions.footnotes.FootnotePostTreeprocessor] | [`treeprocessors`][markdown.treeprocessors.build_treeprocessors] | `footnote-duplicate` | `15` | |
| 95 | | [`FootnotePostprocessor`][markdown.extensions.footnotes.FootnotePostprocessor] | [`postprocessors`][markdown.postprocessors.build_postprocessors] | `footnote` | `25` | |
| 96 | |
| 97 | """ |
| 98 | # flake8: noqa: E501 88-95 |
| 99 | md.registerExtension(self) |
| 100 | self.parser = md.parser |
| 101 | self.md = md |
| 102 | # Insert a `blockprocessor` before `ReferencePreprocessor` |
| 103 | md.parser.blockprocessors.register(FootnoteBlockProcessor(self), 'footnote', 17) |
| 104 | |
| 105 | # Insert an inline pattern before `ImageReferencePattern` |
| 106 | FOOTNOTE_RE = r'\[\^([^\]]*)\]' # blah blah [^1] blah |
| 107 | md.inlinePatterns.register(FootnoteInlineProcessor(FOOTNOTE_RE, self), 'footnote', 175) |
| 108 | # Insert a tree-processor that would actually add the footnote div |
| 109 | # This must be before all other tree-processors (i.e., `inline` and |
| 110 | # `codehilite`) so they can run on the the contents of the div. |
| 111 | md.treeprocessors.register(FootnoteTreeprocessor(self), 'footnote', 50) |
| 112 | |
| 113 | # Insert a tree-processor to reorder the footnotes if necessary. This must be after |
| 114 | # `inline` tree-processor so it can access the footnote reference order |
| 115 | # (`self.footnote_order`) that gets populated by the `FootnoteInlineProcessor`. |
| 116 | if not self.getConfig("USE_DEFINITION_ORDER"): |
| 117 | md.treeprocessors.register(FootnoteReorderingProcessor(self), 'footnote-reorder', 19) |
| 118 | |
| 119 | # Insert a tree-processor that will run after inline is done. |
| 120 | # In this tree-processor we want to check our duplicate footnote tracker |
| 121 | # And add additional `backrefs` to the footnote pointing back to the |
| 122 | # duplicated references. |
| 123 | md.treeprocessors.register(FootnotePostTreeprocessor(self), 'footnote-duplicate', 15) |
| 124 | |
| 125 | # Insert a postprocessor after amp_substitute processor |
| 126 | md.postprocessors.register(FootnotePostprocessor(self), 'footnote', 25) |
| 127 | |
| 128 | def reset(self) -> None: |
| 129 | """ Clear footnotes on reset, and prepare for distinct document. """ |
nothing calls this directly
no test coverage detected