all2md.utils.footnotes

Utilities for collecting and normalizing footnotes across converters.

all2md.utils.footnotes.sanitize_footnote_identifier(identifier: str, *, fallback_prefix: str = 'note') str

Return a Markdown-safe footnote identifier.

Parameters:
  • identifier (str) – Raw identifier that may contain disallowed characters.

  • fallback_prefix (str, default "note") – Prefix used when the sanitized identifier would be empty.

class all2md.utils.footnotes.FootnoteCollector

Bases: object

Store footnote references and definitions with stable ordering.

auto_number_start: int = 1
register_reference(identifier: str | None, *, note_type: str = 'footnote') str

Record a reference and return the canonical identifier.

register_definition(identifier: str | None, content: List[Node], *, note_type: str = 'footnote') str

Record a definition and return the canonical identifier.

iter_definitions(*, note_type_priority: Sequence[str] | None = None) Iterator[FootnoteDefinition]

Yield collected definitions in priority order.

__init__(auto_number_start: int = 1) None