Setup configs.
(self, **kwargs)
| 40 | """ Footnote Extension. """ |
| 41 | |
| 42 | def __init__(self, **kwargs): |
| 43 | """ Setup configs. """ |
| 44 | |
| 45 | self.config = { |
| 46 | 'PLACE_MARKER': [ |
| 47 | '///Footnotes Go Here///', 'The text string that marks where the footnotes go' |
| 48 | ], |
| 49 | 'UNIQUE_IDS': [ |
| 50 | False, 'Avoid name collisions across multiple calls to `reset()`.' |
| 51 | ], |
| 52 | 'BACKLINK_TEXT': [ |
| 53 | '↩', "The text string that links from the footnote to the reader's place." |
| 54 | ], |
| 55 | 'SUPERSCRIPT_TEXT': [ |
| 56 | '{}', "The text string that links from the reader's place to the footnote." |
| 57 | ], |
| 58 | 'BACKLINK_TITLE': [ |
| 59 | 'Jump back to footnote %d in the text', |
| 60 | 'The text string used for the title HTML attribute of the backlink. ' |
| 61 | '%d will be replaced by the footnote number.' |
| 62 | ], |
| 63 | 'SEPARATOR': [ |
| 64 | ':', 'Footnote separator.' |
| 65 | ], |
| 66 | 'USE_DEFINITION_ORDER': [ |
| 67 | True, |
| 68 | 'Order footnote labels by definition order (True) or by document order (False). ' |
| 69 | 'Default: True.' |
| 70 | ] |
| 71 | } |
| 72 | """ Default configuration options. """ |
| 73 | super().__init__(**kwargs) |
| 74 | |
| 75 | # In multiple invocations, emit links that don't get tangled. |
| 76 | self.unique_prefix = 0 |
| 77 | self.found_refs: dict[str, int] = {} |
| 78 | self.used_refs: set[str] = set() |
| 79 | |
| 80 | # Backward compatibility with old '%d' placeholder |
| 81 | self.setConfig('BACKLINK_TITLE', self.getConfig("BACKLINK_TITLE").replace("%d", "{}")) |
| 82 | |
| 83 | self.reset() |
| 84 | |
| 85 | def extendMarkdown(self, md): |
| 86 | """ Add pieces to Markdown. """ |