Skip to content

Commit 036b825

Browse files
authored
refactor: Attach name to processors for easier retrieval
1 parent 08c8945 commit 036b825

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/mkdocs_autorefs/references.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
class AutoRefInlineProcessor(ReferenceInlineProcessor):
4444
"""A Markdown extension."""
4545

46+
name: str = "mkdocs-autorefs"
47+
4648
def __init__(self, *args: Any, **kwargs: Any) -> None: # noqa: D107
4749
super().__init__(REFERENCE_RE, *args, **kwargs)
4850

@@ -224,6 +226,7 @@ def fix_refs(html: str, url_mapper: Callable[[str], str]) -> tuple[str, list[str
224226
class AnchorScannerTreeProcessor(Treeprocessor):
225227
"""Tree processor to scan and register HTML anchors."""
226228

229+
name: str = "mkdocs-autorefs-anchors-scanner"
227230
_htags: ClassVar[set[str]] = {"h1", "h2", "h3", "h4", "h5", "h6"}
228231

229232
def __init__(self, plugin: AutorefsPlugin, md: Markdown | None = None) -> None:
@@ -317,13 +320,13 @@ def extendMarkdown(self, md: Markdown) -> None: # noqa: N802 (casing: parent me
317320
"""
318321
md.inlinePatterns.register(
319322
AutoRefInlineProcessor(md),
320-
"mkdocs-autorefs",
323+
AutoRefInlineProcessor.name,
321324
priority=168, # Right after markdown.inlinepatterns.ReferenceInlineProcessor
322325
)
323326
if self.plugin is not None and self.plugin.scan_toc and "attr_list" in md.treeprocessors:
324327
log.debug("Enabling Markdown anchors feature")
325328
md.treeprocessors.register(
326329
AnchorScannerTreeProcessor(self.plugin, md),
327-
"mkdocs-autorefs-anchors-scanner",
330+
AnchorScannerTreeProcessor.name,
328331
priority=0,
329332
)

0 commit comments

Comments
 (0)