-
Notifications
You must be signed in to change notification settings - Fork 336
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
fix: improve support for math rendering with CDN #2833
Conversation
@hadley I think the CDN approach for katex is the best we're going to do. We'd have to cache ~60 files to fully support katex outside of CDN. |
Thanks @jayhesselberth for this fix. I ran some manual tests on this branch across different
|
Articles need The complex math example ( |
@nanxstats Can you confirm this fixes katex for you? What do you mean by "function reference" in the table above — math included in params and examples? I'm not sure why mathml is not rendering that correctly. |
@jayhesselberth Yes, "function reference" means the function documentation pages under Overall resultsHere is how it looks after the latest patch - KaTeX is now ✨perfect✨
Load MathJaX web fontsYou can configure MathJaX via the In out$uses_mathjax <- config_math_rendering(pkg) == "mathjax" In {{#uses_mathjax}}
<script>
window.MathJax = {
chtml: {
fontURL: "https://cdn.jsdelivr.net/npm/[email protected]/es5/output/chtml/fonts/woff-v2"
}
};
</script>
{{/uses_mathjax}} On MathMLYep, under I do support considering KaTeX as the future default, like you mentioned in #2704. |
Nice, I can confirm MathJax now also loads web fonts properly:
I have no more comments. |
This comment was marked as resolved.
This comment was marked as resolved.
The only other thing I would do here is to add an example using mathml directly for testing purposes, ideally something that can't be used by katex and mathjax |
This PR includes katex and mathjax dependencies via the head template instead of via
cached_dependency()
.This simplifies the katex loading, which otherwise would require caching ~60 katex files.
But once katex material moved to the head template, then it doesn't make sense to have a separate approach for mathjax, so that is moved to the head template too.
Closes #2704