Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add configurable KaTeX location #224

Merged
merged 2 commits into from May 13, 2024
Merged

Conversation

jemos
Copy link
Contributor

@jemos jemos commented Apr 28, 2024

I noticed the theme was using a CDN for the KaTeX library. In context of security it may be preferable to have those libraries locally, from the same domain. I'm open to change this pull-request to work in another way (different variable name, another way of achieving the same result, etc.) if needed.

The patch adds a local_katex variable, which if set, will load the JS/CSS from the base URL. The user of the theme needs to place these files in the page source static/ folder (so it's up to the owner of the site to control the version/files).

Modify the math.html partial to conditionally load KaTeX assets from either a local self-hosted or a remote CDN, depending on the 'local_katex' parameter set in the site's configuration. This approach may improve load times and security.
Copy link

vercel bot commented Apr 28, 2024

@jemos is attempting to deploy a commit to the nanxiaobei's projects Team on Vercel.

A member of the Team first needs to authorize it.

@nanxiaobei
Copy link
Owner

nanxiaobei commented May 7, 2024

Please update local_katex to camelCase to align with other params.

@jemos
Copy link
Contributor Author

jemos commented May 7, 2024

Sorry, I've overlooked that 😅
I've a doubt though, do you prefer localKatex or localKaTeX ?

@nanxiaobei
Copy link
Owner

localKatex would be fine

@nanxiaobei nanxiaobei merged commit 90059f7 into nanxiaobei:main May 13, 2024
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants