Skip to content

Commit

Permalink
CDN font support for Mathjax
Browse files Browse the repository at this point in the history
  • Loading branch information
jayhesselberth committed Jan 6, 2025
1 parent a5c34cc commit cf6c288
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# pkgdown (development version)

* Support for math rendering using katex (`math-rendering: katex`) was improved and now includes necessary components using CDN (#2704).
* Support for math rendering using katex and mathjax was improved and now includes necessary components using CDN (#2704).
* Articles (i.e., Rmarkdown/Quarto documents in `vignettes/articles`, created by `usethis::use_article()` and available on pkgdown sites but not included in a built package) have improved test cases (thanks to @venpopov and @ethanbass).
* New `clean_site(force = TRUE)` for cleaning of `docs/` regardless of whether it was built by pkgdown (#2827).
* Links to favicons in page headers were updated to reflect changes to https://realfavicongenerator.net/ (#2804). Favicons should be re-generated by manually removing the `pkgdown/favicon` directory and then running `pkgdown::build_favicons()`.
Expand Down
1 change: 1 addition & 0 deletions R/render.R
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ data_template <- function(pkg = ".", depth = 0L) {
out$footer <- data_footer(pkg)
out$lightswitch <- uses_lightswitch(pkg)
out$uses_katex <- config_math_rendering(pkg) == "katex"
out$uses_mathjax <- config_math_rendering(pkg) == "mathjax"

print_yaml(out)
}
Expand Down
11 changes: 11 additions & 0 deletions inst/BS5/templates/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@
<script src="{{#site}}{{root}}{{/site}}katex-auto.js"></script>
{{/uses_katex}}

{{#uses_mathjax}}
<!-- mathjax math fonts -->
<script>
window.MathJax = {
chtml: {
fontURL: "https://cdn.jsdelivr.net/npm/[email protected]/es5/output/chtml/fonts/woff-v2"
}
};
</script>
{{/uses_mathjax}}

{{#lightswitch}}<script src="{{#site}}{{root}}{{/site}}lightswitch.js"></script>{{/lightswitch}}

{{{headdeps}}}
Expand Down

0 comments on commit cf6c288

Please sign in to comment.