diff --git a/src/renderer/html_handlebars/hbs_renderer.rs b/src/renderer/html_handlebars/hbs_renderer.rs index 227588e5..5c5c48ef 100644 --- a/src/renderer/html_handlebars/hbs_renderer.rs +++ b/src/renderer/html_handlebars/hbs_renderer.rs @@ -681,10 +681,15 @@ fn make_data( data.insert("mathjax_support".to_owned(), json!(true)); } else if html_config.mathjax.enable { data.insert("mathjax_enable".to_owned(), json!(true)); - data.insert( - "mathjax_source".to_owned(), - json!(html_config.mathjax.source), - ); + if let Some(ref source) = html_config.mathjax.source { + if source.starts_with("/") { + data.insert("mathjax_root".to_owned(), json!(true)); + let (_, relative_source) = source.split_at(1); + data.insert("mathjax_source".to_owned(), json!(relative_source)); + } else { + data.insert("mathjax_source".to_owned(), json!(source)); + } + } data.insert( "mathjax_config".to_owned(), json!(html_config.mathjax.config), diff --git a/src/theme/index.hbs b/src/theme/index.hbs index b5ed08f7..2fdb7a6f 100644 --- a/src/theme/index.hbs +++ b/src/theme/index.hbs @@ -67,9 +67,13 @@ }; {{/if}} + {{#if mathjax_root}} + + {{else}} {{/if}} {{/if}} + {{/if}}