Skip to content

Commit

Permalink
Fix relative path in links plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaprieto committed Oct 23, 2024
1 parent ab6fcde commit 60352ae
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
9 changes: 7 additions & 2 deletions mkdocs_juvix/common/preprocesors/links.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,13 @@ def run(self, lines) -> List[str]:
log.warning("Current page URL not found. Wikilinks will not be processed.")
return lines

filepath = Path(current_page_url)
rel_to_docs = filepath.relative_to(self.env.DOCS_ABSPATH)
filepath = Path(current_page_url).absolute()
try:
rel_to_docs = filepath.relative_to(self.env.DOCS_ABSPATH)
except ValueError:
rel_to_docs = filepath.relative_to(self.env.DOCS_PATH)
finally:
rel_to_docs = filepath

try:
cache_filepath: Optional[Path] = (
Expand Down
6 changes: 3 additions & 3 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "mkdocs-juvix-plugin"
version = "0.3.10"
version = "0.3.11"
description = "Support for Juvix Markdown files in MkDocs"
authors = ["Jonathan Prieto-Cubides, and GitHub contributors"]
license = "MIT"
Expand Down

0 comments on commit 60352ae

Please sign in to comment.