Content Utilities
Add footnotes to a post
The add_footnote_links() function replaces [n] and [^n] with HTML <a> tags that link to each other.
- indieweb_utils.add_footnote_links(text: str, add_sup: bool = False) str [source]
Add HTML footnotes to text.
Footnotes are defined with [int] and referenced with [^int].
- Parameters:
text – Text to add footnotes to
- Returns:
Text with footnotes added
Example:
from indieweb_utils import add_footnote_links
text = ‘This is a footnote [1] and this is a reference [^1].’
print(add_footnote_links(text))