File tree 1 file changed +13
-4
lines changed
1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ r##"<!DOCTYPE html>
53
53
<title>{title}</title>
54
54
55
55
<link rel="stylesheet" type="text/css" href="{root_path}main.css">
56
- <link rel="stylesheet" type="text/css" href="{root_path}katex/katex.min.css">
56
+ {katex_css}
57
57
58
58
{favicon}
59
59
{in_header}
@@ -163,13 +163,22 @@ r##"<!DOCTYPE html>
163
163
} else {
164
164
format!( r#"<script src="{}playpen.js"></script>"# , page. root_path)
165
165
} ,
166
+ katex_css = if layout. enable_math {
167
+ // this is inserted even for pages for which there is no
168
+ // actual mathematics (unlike the JS), but this CSS is quite
169
+ // small, and it's harder to insert this conditionally, since
170
+ // that would require rendering the whole thing into memory
171
+ // and then printing this, and only then print the
172
+ // markdown.
173
+ format!( r#"<link rel="stylesheet" type="text/css" href="{}katex/katex.min.css">"# ,
174
+ page. root_path)
175
+ } else {
176
+ "" . to_string( )
177
+ } ,
166
178
) ) ;
167
179
168
180
// This must be done after everything is rendered, so that
169
181
// `math_seen` captures all possible $$'s on this page.
170
- //
171
- // We conditionally insert only the JS, since it's 5x larger than
172
- // the CSS.
173
182
if layout. enable_math && markdown:: math_seen. get ( ) . map_or ( false , |x| * x) {
174
183
try!( write ! ( dst, "<script src=\" {}katex/katex.min.js\" ></script>" , page. root_path) ) ;
175
184
}
You can’t perform that action at this time.
0 commit comments