# ‹› `markdown.extensions.footnotes`

Adds footnote handling to Python-Markdown.

See the documentation for details.

## ‹› `markdown.extensions.footnotes.FootnoteExtension(**kwargs)`

Bases: `Extension`

Footnote Extension.

### ‹› `markdown.extensions.footnotes.FootnoteExtension.config` `instance-attribute`

Default configuration options.

Defined Value:

    self.config = {
        'PLACE_MARKER': [
            '///Footnotes Go Here///', 'The text string that marks where the footnotes go'
        ],
        'UNIQUE_IDS': [
            False, 'Avoid name collisions across multiple calls to `reset()`.'
        ],
        'BACKLINK_TEXT': [
            '&#8617;', "The text string that links from the footnote to the reader's place."
        ],
        'SUPERSCRIPT_TEXT': [
            '{}', "The text string that links from the reader's place to the footnote."
        ],
        'BACKLINK_TITLE': [
            'Jump back to footnote %d in the text',
            'The text string used for the title HTML attribute of the backlink. '
            '%d will be replaced by the footnote number.'
        ],
        'SEPARATOR': [
            ':', 'Footnote separator.'
        ]
    }

### ‹› `markdown.extensions.footnotes.FootnoteExtension.extendMarkdown(md)`

Add pieces to Markdown.

### ‹› `markdown.extensions.footnotes.FootnoteExtension.reset() -> None`

Clear footnotes on reset, and prepare for distinct document.

### ‹› `markdown.extensions.footnotes.FootnoteExtension.unique_ref(reference: str, found: bool = False) -> str`

Get a unique reference if there are duplicates.

### ‹› `markdown.extensions.footnotes.FootnoteExtension.findFootnotesPlaceholder(root: etree.Element) -> tuple[etree.Element, etree.Element, bool] | None`

Return ElementTree Element that contains Footnote placeholder.

### ‹› `markdown.extensions.footnotes.FootnoteExtension.setFootnote(id: str, text: str) -> None`

Store a footnote for later retrieval.

### ‹› `markdown.extensions.footnotes.FootnoteExtension.get_separator() -> str`

Get the footnote separator.

### ‹› `markdown.extensions.footnotes.FootnoteExtension.makeFootnoteId(id: str) -> str`

Return footnote link id.

### ‹› `markdown.extensions.footnotes.FootnoteExtension.makeFootnoteRefId(id: str, found: bool = False) -> str`

Return footnote back-link id.

### ‹› `markdown.extensions.footnotes.FootnoteExtension.makeFootnotesDiv(root: etree.Element) -> etree.Element | None`

Return `div` of footnotes as `etree` Element.

## ‹› `markdown.extensions.footnotes.FootnoteBlockProcessor(footnotes: FootnoteExtension)`

Bases: `BlockProcessor`

Find all footnote references and store for later use.

### ‹› `markdown.extensions.footnotes.FootnoteBlockProcessor.run(parent: etree.Element, blocks: list[str]) -> bool`

Find, set, and remove footnote definitions.

### ‹› `markdown.extensions.footnotes.FootnoteBlockProcessor.detectTabbed(blocks: list[str]) -> list[str]`

Find indented text and remove indent before further processing.

Returns:

- `list[str]` –

  A list of blocks with indentation removed.

### ‹› `markdown.extensions.footnotes.FootnoteBlockProcessor.detab(block: str) -> str`

Remove one level of indent from a block.

Preserve lazily indented blocks by only removing indent from indented lines.

## ‹› `markdown.extensions.footnotes.FootnoteInlineProcessor(pattern: str, footnotes: FootnoteExtension)`

Bases: `InlineProcessor`

`InlineProcessor` for footnote markers in a document’s body text.

## ‹› `markdown.extensions.footnotes.FootnotePostTreeprocessor(footnotes: FootnoteExtension)`

Bases: `Treeprocessor`

Amend footnote div with duplicates.

### ‹› `markdown.extensions.footnotes.FootnotePostTreeprocessor.add_duplicates(li: etree.Element, duplicates: int) -> None`

Adjust current `li` and add the duplicates: `fnref2`, `fnref3`, etc.

### ‹› `markdown.extensions.footnotes.FootnotePostTreeprocessor.get_num_duplicates(li: etree.Element) -> int`

Get the number of duplicate refs of the footnote.

### ‹› `markdown.extensions.footnotes.FootnotePostTreeprocessor.handle_duplicates(parent: etree.Element) -> None`

Find duplicate footnotes and format and add the duplicates.

### ‹› `markdown.extensions.footnotes.FootnotePostTreeprocessor.run(root: etree.Element) -> None`

Crawl the footnote div and add missing duplicate footnotes.

## ‹› `markdown.extensions.footnotes.FootnoteTreeprocessor(footnotes: FootnoteExtension)`

Bases: `Treeprocessor`

Build and append footnote div to end of document.

## ‹› `markdown.extensions.footnotes.FootnotePostprocessor(footnotes: FootnoteExtension)`

Bases: `Postprocessor`

Replace placeholders with html entities.

## ‹› `markdown.extensions.footnotes.makeExtension(**kwargs)`

Return an instance of the `FootnoteExtension`