Skip to content

Commit

Permalink
fixup! feat: Add option to scan and register HTML anchors
Browse files Browse the repository at this point in the history
  • Loading branch information
pawamoy committed Feb 17, 2024
1 parent 38cdd64 commit 931ccd0
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 14 deletions.
7 changes: 0 additions & 7 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
--8<-- "README.md"

[](){#hello}
## Hello world

helllo.

[hello][hello]
7 changes: 0 additions & 7 deletions src/mkdocs_autorefs/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import contextlib
import functools
import logging
import re
from functools import partial
from typing import TYPE_CHECKING, Any, Callable, Sequence
from urllib.parse import urlsplit
Expand Down Expand Up @@ -66,8 +65,6 @@ class AutorefsPlugin(BasePlugin[AutorefsConfig]):
scan_anchors: bool = False
current_page: str | None = None

_re_anchors = re.compile(r'<a(?:\s+href="([^"]*)")?\s+id="([^"]+)"\s*>')

def __init__(self) -> None:
"""Initialize the object."""
super().__init__()
Expand Down Expand Up @@ -190,10 +187,6 @@ def on_page_content(self, html: str, page: Page, **kwargs: Any) -> str: # noqa:
for item in page.toc.items:
self.map_urls(page.url, item)

# if self.scan_anchors or self.config.scan_anchors:
# for href, hid in re.findall(self._re_anchors, html):
# self.register_anchor(page.url, identifier=hid, anchor=href.lstrip("#"))

return html

def map_urls(self, base_url: str, anchor: AnchorLink) -> None:
Expand Down

0 comments on commit 931ccd0

Please sign in to comment.