βΉβΊ
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
dictionaryto our glossary. Any abbreviations that already exist will be overwritten. -
extendMarkdownβInsert
AbbrTreeprocessorandAbbrBlockprocessor.
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()
ΒΆ
Clear all previously defined abbreviations.
βΉβΊ
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
abbrelement. -
iter_elementβRecursively iterate over elements, run regex on text and wrap matches in
abbrtags. -
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.

