‹›
markdown.extensions.attr_list
¶
Adds attribute list syntax. Inspired by Maruku’s feature of the same name.
See the documentation for details.
Classes:
-
AttrListTreeprocessor– -
AttrListExtension–Attribute List extension for Python-Markdown
Functions:
-
get_attrs_and_remainder–Parse attribute list and return a list of attribute tuples.
-
get_attrs–Soft-deprecated. Prefer
get_attrs_and_remainder.
‹›
markdown.extensions.attr_list.get_attrs_and_remainder(attrs_string: str) -> tuple[list[tuple[str, str]], str]
¶
Parse attribute list and return a list of attribute tuples.
Additionally, return any text that remained after a curly brace. In typical cases, its presence should mean that the input does not match the intended attribute list syntax.
‹›
markdown.extensions.attr_list.get_attrs(str: str) -> list[tuple[str, str]]
¶
Soft-deprecated. Prefer get_attrs_and_remainder.
‹›
markdown.extensions.attr_list.AttrListTreeprocessor(md: Markdown | None = None)
¶
Bases: Treeprocessor
Methods:
-
assign_attrs–Assign
attrsto element. -
sanitize_name–Sanitize name as ‘an XML Name, minus the
:.’
‹›
markdown.extensions.attr_list.AttrListTreeprocessor.assign_attrs(elem: Element, attrs_string: str, *, strict: bool = False) -> str
¶
Assign attrs to element.
If the attrs_string has an extra closing curly brace, the remaining text is returned.
The strict argument controls whether to still assign attrs if there is a remaining }.
‹›
markdown.extensions.attr_list.AttrListTreeprocessor.sanitize_name(name: str) -> str
¶
Sanitize name as ‘an XML Name, minus the :.’
See https://www.w3.org/TR/REC-xml-names/#NT-NCName.

