Skip to content

Commit 8097a67

Browse files
committed
common: Append file:// prefix rather than removing it
1 parent f9b4b40 commit 8097a67

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

markups/common.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
or os.getenv("APPDATA")
1212
or os.path.expanduser("~/.config")
1313
)
14-
MATHJAX2_LOCAL_URLS = (
15-
"file:///usr/share/javascript/mathjax/MathJax.js", # Debian libjs-mathjax
16-
"file:///usr/share/mathjax2/MathJax.js", # Arch Linux mathjax2
14+
MATHJAX2_LOCAL_FILES = (
15+
"/usr/share/javascript/mathjax/MathJax.js", # Debian libjs-mathjax
16+
"/usr/share/mathjax2/MathJax.js", # Arch Linux mathjax2
1717
)
18-
MATHJAX3_LOCAL_URLS = (
19-
"file:///usr/share/nodejs/mathjax-full/es5/tex-chtml.js", # Debian node-mathjax-full
20-
"file:///usr/share/mathjax/tex-chtml.js", # Arch Linux mathjax
18+
MATHJAX3_LOCAL_FILES = (
19+
"/usr/share/nodejs/mathjax-full/es5/tex-chtml.js", # Debian node-mathjax-full
20+
"/usr/share/mathjax/tex-chtml.js", # Arch Linux mathjax
2121
)
2222
MATHJAX_WEB_URL = "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js"
2323

@@ -41,10 +41,10 @@ def get_pygments_stylesheet(selector: str | None, style: str | None = None) -> s
4141

4242
def get_mathjax_url_and_version(webenv: bool) -> tuple[str, int]:
4343
if not webenv:
44-
for url in MATHJAX3_LOCAL_URLS:
45-
if os.path.exists(url[7:]): # strip file://
46-
return url, 3
47-
for url in MATHJAX2_LOCAL_URLS:
48-
if os.path.exists(url[7:]):
49-
return url, 2
44+
for path in MATHJAX3_LOCAL_FILES:
45+
if os.path.exists(path):
46+
return f"file://{path}", 3
47+
for path in MATHJAX2_LOCAL_FILES:
48+
if os.path.exists(path):
49+
return f"file://{path}", 2
5050
return MATHJAX_WEB_URL, 3

0 commit comments

Comments
 (0)