Skip to content

Commit

Permalink
Consolidate mathjax content in head template
Browse files Browse the repository at this point in the history
  • Loading branch information
jayhesselberth committed Mar 2, 2025
1 parent 6d685fd commit c89745f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 21 deletions.
21 changes: 1 addition & 20 deletions R/external-deps.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,27 +52,8 @@ external_dependencies <- function(pkg, call = caller_env()) {
integrity = "sha512-5CYOlHXGh6QpOFA/TeTylKLWfB3ftPsde7AnmhuitiTX4K5SqCLBeKro6sPS8ilsz1Q4NRx3v8Ko2IBiszzdww=="
)
)
),
math_dependency(pkg, call = call)
))
}

math_dependency <- function(pkg, call = caller_env()) {
math <- config_math_rendering(pkg)
if (math == "mathjax") {
cached_dependency(
name = "MathJax",
version = "3.2.2",
files = list(
list(
url = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/3.2.2/es5/tex-chtml.min.js",
integrity = "sha512-T8xxpazDtODy3WOP/c6hvQI2O9UPdARlDWE0CvH1Cfqc0TXZF6GZcEKL7tIR8VbfS/7s/J6C+VOqrD6hIo++vQ=="
)
)
)
} else {
NULL
}
))
}

cached_dependency <- function(name, version, files) {
Expand Down
3 changes: 2 additions & 1 deletion inst/BS5/templates/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
{{/uses_katex}}

{{#uses_mathjax}}
<!-- mathjax math fonts -->
<!-- mathjax math -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/es5/tex-mml-chtml.js" integrity="sha256-MASABpB4tYktI2Oitl4t+78w/lyA+D7b/s9GEP0JOGI=" crossorigin="anonymous"></script>
<script>
window.MathJax = {
chtml: {
Expand Down

0 comments on commit c89745f

Please sign in to comment.