File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -654,10 +654,15 @@ fn make_data(
654
654
data. insert ( "mathjax_support" . to_owned ( ) , json ! ( true ) ) ;
655
655
} else if html_config. mathjax . enable {
656
656
data. insert ( "mathjax_enable" . to_owned ( ) , json ! ( true ) ) ;
657
- data. insert (
658
- "mathjax_source" . to_owned ( ) ,
659
- json ! ( html_config. mathjax. source) ,
660
- ) ;
657
+ if let Some ( ref source) = html_config. mathjax . source {
658
+ if source. starts_with ( "/" ) {
659
+ data. insert ( "mathjax_root" . to_owned ( ) , json ! ( true ) ) ;
660
+ let ( _, relative_source) = source. split_at ( 1 ) ;
661
+ data. insert ( "mathjax_source" . to_owned ( ) , json ! ( relative_source) ) ;
662
+ } else {
663
+ data. insert ( "mathjax_source" . to_owned ( ) , json ! ( source) ) ;
664
+ }
665
+ }
661
666
data. insert (
662
667
"mathjax_config" . to_owned ( ) ,
663
668
json ! ( html_config. mathjax. config) ,
Original file line number Diff line number Diff line change 68
68
};
69
69
</script >
70
70
{{ /if }}
71
+ {{ #if mathjax_root }}
72
+ <script id =" MathJax-script" async src =" {{ path_to_root }}{{ mathjax_source }} /{{ mathjax_config }} .js" ></script >
73
+ {{ else }}
71
74
<script id =" MathJax-script" async src =" {{ mathjax_source }} /{{ mathjax_config }} .js" ></script >
72
75
{{ /if }}
73
76
{{ /if }}
77
+ {{ /if }}
74
78
</head >
75
79
<body >
76
80
<!-- Provide site root to javascript -->
You can’t perform that action at this time.
0 commit comments