‹›
markdown.extensions.abbr
¶
This extension adds abbreviation handling to Python-Markdown.
See the documentation for details.
Classes:
-
AbbrExtension
–Abbreviation Extension for Python-Markdown.
-
AbbrTreeprocessor
–Replace abbreviation text with
<abbr>
elements. -
AbbrBlockprocessor
–Parse text for abbreviation references.
-
AbbrInlineProcessor
–Abbreviation inline pattern.
‹›
markdown.extensions.abbr.AbbrExtension(**kwargs)
¶
Bases: Extension
Abbreviation Extension for Python-Markdown.
Methods:
-
reset
–Clear all previously defined abbreviations.
-
reset_glossary
–Clear all abbreviations from the glossary.
-
load_glossary
–Adds
dictionary
to our glossary. Any abbreviations that already exist will be overwritten. -
extendMarkdown
–Insert
AbbrTreeprocessor
andAbbrBlockprocessor
.
Attributes:
-
config
–Default configuration options.
‹›
markdown.extensions.abbr.AbbrExtension.config
instance-attribute
¶
Default configuration options.
Defined Value:
self.config = {
'glossary': [
{},
'A dictionary where the `key` is the abbreviation and the `value` is the definition.'
"Default: `{}`"
],
}
‹›
markdown.extensions.abbr.AbbrExtension.reset_glossary()
¶
Clear all abbreviations from the glossary.
‹›
markdown.extensions.abbr.AbbrTreeprocessor(md: Markdown | None = None, abbrs: dict | None = None)
¶
Bases: Treeprocessor
Replace abbreviation text with <abbr>
elements.
Methods:
-
create_element
–Create an
abbr
element. -
iter_element
–Recursively iterate over elements, run regex on text and wrap matches in
abbr
tags. -
run
–Step through tree to find known abbreviations.
‹›
markdown.extensions.abbr.AbbrTreeprocessor.create_element(title: str, text: str, tail: str) -> etree.Element
¶
Create an abbr
element.
‹›
markdown.extensions.abbr.AbbrBlockprocessor(parser: BlockParser, abbrs: dict)
¶
Bases: BlockProcessor
Parse text for abbreviation references.
Methods:
-
run
–Find and remove all abbreviation references from the text.
‹›
markdown.extensions.abbr.AbbrInlineProcessor(pattern: str, title: str)
deprecated
¶
Bases: InlineProcessor
Deprecated
This class will be removed in the future; use AbbrTreeprocessor
instead.
Abbreviation inline pattern.