# ‹› `` `markdown.extensions.legacy_attrs`

An extension to Python Markdown which implements legacy attributes.

Prior to Python-Markdown version 3.0, the Markdown class had an `enable_attributes` keyword which was on by default and provided for attributes to be defined for elements using the format `{@key=value}`. This extension is provided as a replacement for backward compatibility. New documents should be authored using `attr_lists`. However, numerous documents exist which have been using the old attribute format for many years. This extension can be used to continue to render those documents correctly.

Classes:

- `LegacyAttrs` –
- `LegacyAttrExtension` –

## ‹› `` `markdown.extensions.legacy_attrs.LegacyAttrs(md: Markdown | None = None)`

Bases: `Treeprocessor`

Methods:

- `run` –

  Find and set values of attributes ({@key=value}).

- `handleAttributes` –

  Set attributes and return text without definitions.

### ‹› `` `markdown.extensions.legacy_attrs.LegacyAttrs.run(doc: etree.Element) -> None`

Find and set values of attributes ({@key=value}).

### ‹› `` `markdown.extensions.legacy_attrs.LegacyAttrs.handleAttributes(el: etree.Element, txt: str) -> str`

Set attributes and return text without definitions.

## ‹› `` `markdown.extensions.legacy_attrs.LegacyAttrExtension(**kwargs)`

Bases: `Extension`

Methods:

- `extendMarkdown` –

  Register the processor.

### ‹› `` `markdown.extensions.legacy_attrs.LegacyAttrExtension.extendMarkdown(md)`

Register the processor.

Class Instance | Registry | Name | Priority
--- | --- | --- | ---
`LegacyAttrs` | `treeprocessors` | `legacyattrs` | `15`