diff --git a/guide/src/format/configuration/renderers.md b/guide/src/format/configuration/renderers.md
index a827d2936f..3ee87aaa97 100644
--- a/guide/src/format/configuration/renderers.md
+++ b/guide/src/format/configuration/renderers.md
@@ -99,6 +99,7 @@ default-theme = "light"
preferred-dark-theme = "navy"
smart-punctuation = true
mathjax-support = false
+asciimath-support = false
copy-fonts = true
additional-css = ["custom.css", "custom2.css"]
additional-js = ["custom.js"]
@@ -128,6 +129,8 @@ The following configuration options are available:
- **curly-quotes:** Deprecated alias for `smart-punctuation`.
- **mathjax-support:** Adds support for [MathJax](../mathjax.md). Defaults to
`false`.
+- **asciimath-support:** Enables AsciiMath for [MathJax](../mathjax.md) if enabled, otherwise has no effect. Defaults to
+ `false`.
- **copy-fonts:** (**Deprecated**) If `true` (the default), mdBook uses its built-in fonts which are copied to the output directory.
If `false`, the built-in fonts will not be used.
This option is deprecated. If you want to define your own custom fonts,
diff --git a/guide/src/format/mathjax.md b/guide/src/format/mathjax.md
index 3dd792159d..e1d6768f46 100644
--- a/guide/src/format/mathjax.md
+++ b/guide/src/format/mathjax.md
@@ -41,3 +41,16 @@ you would write:
```bash
\\[ \mu = \frac{1}{N} \sum_{i=0} x_i \\]
```
+
+### AsciiMath syntax
+
+[AsciiMath](http://asciimath.org/) is a less verbose equation syntax than LaTeX, delimited by \\\`...\\\`.
+
+To enable AsciiMath, you need to add the `asciimath-support` key to your `book.toml`
+under the `output.html` section, in addition to enabling `mathjax-support`:
+
+```toml
+[output.html]
+mathjax-support = true
+asciimath-support = true
+```
\ No newline at end of file
diff --git a/src/config.rs b/src/config.rs
index 905020a39c..8852bcfa6e 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -535,6 +535,8 @@ pub struct HtmlConfig {
pub curly_quotes: bool,
/// Should mathjax be enabled?
pub mathjax_support: bool,
+ /// Should asciimath be enabled?
+ pub asciimath_support: bool,
/// Whether to fonts.css and respective font files to the output directory.
pub copy_fonts: bool,
/// An optional google analytics code.
@@ -601,6 +603,7 @@ impl Default for HtmlConfig {
smart_punctuation: false,
curly_quotes: false,
mathjax_support: false,
+ asciimath_support: 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 02951c2559..ff577abc6d 100644
--- a/src/renderer/html_handlebars/hbs_renderer.rs
+++ b/src/renderer/html_handlebars/hbs_renderer.rs
@@ -549,6 +549,10 @@ fn make_data(
data.insert("mathjax_support".to_owned(), json!(true));
}
+ if html_config.asciimath_support {
+ data.insert("asciimath_support".to_owned(), json!(true));
+ }
+
// This `matches!` checks for a non-empty file.
if html_config.copy_fonts || matches!(theme.fonts_css.as_deref(), Some([_, ..])) {
data.insert("copy_fonts".to_owned(), json!(true));
diff --git a/src/theme/index.hbs b/src/theme/index.hbs
index b9d37f3128..15d8bc3d81 100644
--- a/src/theme/index.hbs
+++ b/src/theme/index.hbs
@@ -50,9 +50,13 @@
{{#if mathjax_support}}
+ {{#if asciimath_support}}
+
+ {{else}}
{{/if}}
-
+ {{/if}}
+