-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Load KaTeX asynchronously using script async #1064
Comments
I can't see why it wouldn't work with |
I believe so. I tested it with the latest alpha version (beta version 404s because it has yet to propagate across the CDN), and it seems to just work. I also tested loading the CSS asynchronously by adding the following to the auto-render code. var link = document.createElement("link");
link.rel = "stylesheet";
link.href = "https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.9.0-alpha2/katex.min.css";
link.integrity = "sha384-exe4Ak6B0EoJI0ogGxjJ8rn+RN3ftPnEQrGwX59KTCl5ybGzvHGKjhPKk/KC3abb" ;
link.crossorigin="anonymous";
document.getElementsByTagName("head")[0].appendChild(link); I had to use the |
Having an async example sounds cool. Calling autorender or whatever upon |
@aterenin if you have some time, would you mind adding a note in the README.md? |
The code I have above is, for whatever reason, not reliable - have noticed on my own site that it occasionally fails to load the style sheet. I've thus reverted back to what is in README.md but if I end up figuring out what to change to make it work consistently I'll document everything. |
Maybe consider this technique? That's a nice way for those of us who are preprocessing the math on the server to load the css. |
KaTeX seems to work out of the box with
script async
. If there are no major drawbacks from using this, I suggest adding it to the README.The text was updated successfully, but these errors were encountered: