Skip to content

Commit

Permalink
fix: ignore external http(s) links in checks
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasDoesThings committed Jan 27, 2024
1 parent 869861c commit c544efb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mkdocs_exclude_unused_files/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,13 @@ def on_post_page(self, output: str, page: Page, config: MkDocsConfig) -> Optiona

for tag, attr in html_tags.items():
for file in soup.find_all(tag, {attr: True}):
if unquote(file[attr]).startswith(("http://", "https://")):
continue

path_check = path.join(path.dirname(page.file.abs_dest_path), unquote(file[attr]))
for suffix in self.config.file_name_suffixes_to_trim:
if path_check.endswith(suffix):
path_check = path_check[:-len(suffix)]
path_check = path_check[: -len(suffix)]

if path.exists(Path(path_check).resolve()):
discarded_path = str(Path(path_check).resolve())
Expand Down

0 comments on commit c544efb

Please sign in to comment.