44# ' markdown documents.
55# ' The conversion is done in R using V8 ("server-side"), hence the resulting fragment can
66# ' be inserted into an HTML document without the need for a JavaScript library like MathJax.
7- # ' Only the [katex.css](https://cdn.jsdelivr.net/npm/[email protected] .3 /dist/katex.min.css)7+ # ' Only the [katex.css](https://cdn.jsdelivr.net/npm/[email protected] .9 /dist/katex.min.css)88# ' style file is required in the final html document.
99# ' Use [math_to_rd] for embedding math into R documentation (`.rd`) pages.
1010# '
@@ -48,7 +48,7 @@ katex_html <- function(tex, displayMode = TRUE, ..., include_css = FALSE, previe
4848 viewer(tmp )
4949 }
5050 if (isTRUE(include_css ))
51- html <- paste(
' <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/[email protected] .3 /dist/katex.min.css" data-external="1">' ,
html ,
sep = ' \n ' )
51+ html <- paste(
' <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/[email protected] .9 /dist/katex.min.css" data-external="1">' ,
html ,
sep = ' \n ' )
5252 structure(html , class = c(' html' , ' character' ))
5353}
5454
@@ -67,11 +67,11 @@ example_math <- function(){
6767# ' @importFrom V8 v8
6868.onLoad <- function (lib , pkg ){
6969 assign(" ctx" , V8 :: v8(" window" ), environment(.onLoad ))
70- ctx $ source(system.file(" js/katex-0.16.3 .min.js" , package = pkg ))
71- ctx $ source(system.file(" js/cheerio-0.22.min.js" , package = pkg ))
72- ctx $ source(system.file(" js/bindings.js" , package = pkg ))
70+ ctx $ source(system.file(" js/katex-0.16.9 .min.js" , package = pkg , mustWork = TRUE ))
71+ ctx $ source(system.file(" js/cheerio-0.22.min.js" , package = pkg , mustWork = TRUE ))
72+ ctx $ source(system.file(" js/bindings.js" , package = pkg , mustWork = TRUE ))
7373 if (identical(.Platform $ OS.type , ' windows' ) && getRversion() < ' 4.1.2' ){
74- ctx $ source(system.file(" js/he.min.js" , package = pkg ))
74+ ctx $ source(system.file(" js/he.min.js" , package = pkg , mustWork = TRUE ))
7575 ctx $ eval(' function escape_utf8(rd){return he.encode(rd, {allowUnsafeSymbols: true})}' )
7676 }
7777}
@@ -92,7 +92,7 @@ template <- '<!DOCTYPE html>
9292<html>
9393 <head>
9494 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
95- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected] .3 /dist/katex.min.css" data-external="1"> 95+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected] .9 /dist/katex.min.css" data-external="1"> 9696 </head>
9797 <body>
9898 {{math}}
0 commit comments