Skip to content

Commit

Permalink
Update to use POSIX paths for MkDocs starting from version 1.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Artem Sedov committed Feb 21, 2023
1 parent ad131a3 commit 287b741
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mkdocs_autolinks_plugin/plugin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import logging
import os
import pathlib
import re
from urllib.parse import quote
import logging
Expand Down Expand Up @@ -60,8 +61,8 @@ def __call__(self, match):
)

abs_link_path = abs_link_paths[0]
rel_link_path = quote(os.path.relpath(abs_link_path, abs_linker_dir))

rel_link_path = quote(pathlib.PurePath(os.path.relpath(abs_link_path, abs_linker_dir)).as_posix())
# Construct the return link by replacing the filename with the relative path to the file
return match.group(0).replace(match.group(3), rel_link_path)

Expand Down

0 comments on commit 287b741

Please sign in to comment.