From 60352ae5f018900054fc88c279a0ec708a9e92f3 Mon Sep 17 00:00:00 2001 From: Jonathan Cubides Date: Tue, 22 Oct 2024 23:45:41 -0500 Subject: [PATCH] Fix relative path in links plugin --- mkdocs_juvix/common/preprocesors/links.py | 9 +++++++-- poetry.lock | 6 +++--- pyproject.toml | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/mkdocs_juvix/common/preprocesors/links.py b/mkdocs_juvix/common/preprocesors/links.py index cc82691..6dd77a6 100644 --- a/mkdocs_juvix/common/preprocesors/links.py +++ b/mkdocs_juvix/common/preprocesors/links.py @@ -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] = ( diff --git a/poetry.lock b/poetry.lock index bad0a0c..80a1b4e 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1756,13 +1756,13 @@ idna2008 = ["idna"] [[package]] name = "rich" -version = "13.9.2" +version = "13.9.3" description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal" optional = false python-versions = ">=3.8.0" files = [ - {file = "rich-13.9.2-py3-none-any.whl", hash = "sha256:8c82a3d3f8dcfe9e734771313e606b39d8247bb6b826e196f4914b333b743cf1"}, - {file = "rich-13.9.2.tar.gz", hash = "sha256:51a2c62057461aaf7152b4d611168f93a9fc73068f8ded2790f29fe2b5366d0c"}, + {file = "rich-13.9.3-py3-none-any.whl", hash = "sha256:9836f5096eb2172c9e77df411c1b009bace4193d6a481d534fea75ebba758283"}, + {file = "rich-13.9.3.tar.gz", hash = "sha256:bc1e01b899537598cf02579d2b9f4a415104d3fc439313a7a2c165d76557a08e"}, ] [package.dependencies] diff --git a/pyproject.toml b/pyproject.toml index fba4a92..d3aaa71 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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"