‹› markdown.extensions.attr_list

Adds attribute list syntax. Inspired by Maruku’s feature of the same name.

See the documentation for details.

‹› 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

‹› 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.

‹› markdown.extensions.attr_list.AttrListExtension(**kwargs)

Bases: Extension

Attribute List extension for Python-Markdown