From 3b4fad5e5e6d04b2fd7fd3a09df6d7af2994546b Mon Sep 17 00:00:00 2001 From: StevenHe Date: Sat, 19 Mar 2022 08:38:20 +0800 Subject: [PATCH] =?UTF-8?q?add=20option=20to=20enable=20inline=20math=20$?= =?UTF-8?q?=E2=80=A6$?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/config.rs | 3 +++ src/renderer/html_handlebars/hbs_renderer.rs | 4 ++++ src/theme/index.hbs | 6 ++++++ 3 files changed, 13 insertions(+) diff --git a/src/config.rs b/src/config.rs index daeccbd035..d5713aba82 100644 --- a/src/config.rs +++ b/src/config.rs @@ -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. @@ -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(), diff --git a/src/renderer/html_handlebars/hbs_renderer.rs b/src/renderer/html_handlebars/hbs_renderer.rs index 69dc31248c..459468fc93 100644 --- a/src/renderer/html_handlebars/hbs_renderer.rs +++ b/src/renderer/html_handlebars/hbs_renderer.rs @@ -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)); } diff --git a/src/theme/index.hbs b/src/theme/index.hbs index 966eedbcef..c6746cb300 100644 --- a/src/theme/index.hbs +++ b/src/theme/index.hbs @@ -52,6 +52,12 @@ {{#if mathjax_support}} + {{#if inline_math_dollar_sign}} + + + {{/if}} {{/if}}