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)
2222MATHJAX_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
4242def 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