Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,8 @@ pub struct HtmlConfig {
pub curly_quotes: bool,
/// Should mathjax be enabled?
pub mathjax_support: bool,
/// Should mathjax enable `$…$` inline math? This option has no effect if mathjax is not enabled.
pub inline_math_dollar_sign: bool,
/// Whether to fonts.css and respective font files to the output directory.
pub copy_fonts: bool,
/// An optional google analytics code.
Expand Down Expand Up @@ -554,6 +556,7 @@ impl Default for HtmlConfig {
preferred_dark_theme: None,
curly_quotes: false,
mathjax_support: false,
inline_math_dollar_sign: false,
copy_fonts: true,
google_analytics: None,
additional_css: Vec::new(),
Expand Down
4 changes: 4 additions & 0 deletions src/renderer/html_handlebars/hbs_renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,10 @@ fn make_data(
data.insert("mathjax_support".to_owned(), json!(true));
}

if html_config.inline_math_dollar_sign {
data.insert("inline_math_dollar_sign".to_owned(), json!(true));
}

if html_config.copy_fonts {
data.insert("copy_fonts".to_owned(), json!(true));
}
Expand Down
6 changes: 6 additions & 0 deletions src/theme/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@
{{#if mathjax_support}}
<!-- MathJax -->
<script async type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
{{#if inline_math_dollar_sign}}
<!-- use $...$ for inline math -->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: {inlineMath: [["$","$"]]} })
</script>
{{/if}}
{{/if}}
</head>
<body>
Expand Down