From 88ce2484ff6992806d38f4f16165d6771963412b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?= Date: Sat, 17 Feb 2024 17:09:07 +0100 Subject: [PATCH] fixup! feat: Add option to scan and register HTML anchors --- src/mkdocs_autorefs/references.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mkdocs_autorefs/references.py b/src/mkdocs_autorefs/references.py index 7918100..bcdd6a9 100644 --- a/src/mkdocs_autorefs/references.py +++ b/src/mkdocs_autorefs/references.py @@ -252,7 +252,7 @@ def __init__( """Initialize the Markdown extension. Parameters: - anchor_scanner_factory: A callable that returns an instance of the anchor scanner tree processor. + plugin: An optional reference to the autorefs plugin (to pass it to the anchor scanner tree processor). **kwargs: Keyword arguments passed to the [base constructor][markdown.extensions.Extension]. """ super().__init__(**kwargs) @@ -262,6 +262,8 @@ def extendMarkdown(self, md: Markdown) -> None: # noqa: N802 (casing: parent me """Register the extension. Add an instance of our [`AutoRefInlineProcessor`][mkdocs_autorefs.references.AutoRefInlineProcessor] to the Markdown parser. + Also optionally add an instance of our [`AnchorScannerTreeProcessor`][mkdocs_autorefs.references.AnchorScannerTreeProcessor] + to the Markdown parser if a reference to the autorefs plugin was passed to this extension. Arguments: md: A `markdown.Markdown` instance.