autorefs
autorefs copied to clipboard
refactor: Use a custom autoref HTML tag
This changes the HTML tags used for auto-references from span to a custom autoref tag. This is made backward compatible by regex-replacing using both the old regex and the new one. The new regex is much, much simpler. Additional HTML attributes are parsed with a proper HTML parser, so ordering does not matter anymore.
Transition period:
- A new mkdocs-autorefs version is released. It's backward compatible: mkdocstrings handlers (and any other project) will continue working as usual, even if they manually insert autorefs
spans in their templates and/or docs. - A change is made in mkdocstrings-python (and other handlers) to support the new
autorefHTML tag, settingAutorefsPlugin.legacy_refstoFalseto disable legacy refs (no perf loss). Handlers will require the new version of mkdocs-autorefs in their dependencies. - In the future, legacy refs are removed from mkdocs-autorefs, and handlers setting
AutorefsPlugin.legacy_refswill be warned by type-checkers that thislegacy_refsattribute does not exist anymore. At runtime, it will have no effect.