diff --git a/mkdocs_with_pdf/templates/filters/url.py b/mkdocs_with_pdf/templates/filters/url.py index c7470e9d..909ea047 100644 --- a/mkdocs_with_pdf/templates/filters/url.py +++ b/mkdocs_with_pdf/templates/filters/url.py @@ -1,4 +1,5 @@ import os +import sys from urllib.parse import urlparse from . import _FilterBase @@ -29,7 +30,9 @@ def __call__(self, pathname: str) -> str: continue path = os.path.abspath(os.path.join(d, pathname)) if os.path.isfile(path): - return 'file://' + path + return 'file:///' + path.replace("\\", "/") \ + if sys.platform == 'win32' \ + else 'file://' + path # not found? return pathname