File tree Expand file tree Collapse file tree 6 files changed +28
-0
lines changed Expand file tree Collapse file tree 6 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -99,6 +99,7 @@ default-theme = "light"
99
99
preferred-dark-theme = " navy"
100
100
curly-quotes = true
101
101
mathjax-support = false
102
+ asciimath-support = false
102
103
copy-fonts = true
103
104
additional-css = [" custom.css" , " custom2.css" ]
104
105
additional-js = [" custom.js" ]
@@ -126,6 +127,8 @@ The following configuration options are available:
126
127
that occur in code blocks and code spans. Defaults to ` false ` .
127
128
- ** mathjax-support:** Adds support for [ MathJax] ( ../mathjax.md ) . Defaults to
128
129
` false ` .
130
+ - ** asciimath-support:** Enables AsciiMath for [ MathJax] ( ../mathjax.md ) if enabled, otherwise has no effect. Defaults to
131
+ ` false ` .
129
132
- ** copy-fonts:** (** Deprecated** ) If ` true ` (the default), mdBook uses its built-in fonts which are copied to the output directory.
130
133
If ` false ` , the built-in fonts will not be used.
131
134
This option is deprecated. If you want to define your own custom fonts,
Original file line number Diff line number Diff line change @@ -41,3 +41,16 @@ you would write:
41
41
``` bash
42
42
\\ [ \m u = \f rac{1}{N} \s um_{i= 0} x_i \\ ]
43
43
```
44
+
45
+ ### AsciiMath syntax
46
+
47
+ [ AsciiMath] ( http://asciimath.org/ ) is a less verbose equation syntax than LaTeX, delimited by <kbd >\\\` ...\\\` </kbd >.
48
+
49
+ To enable AsciiMath, you need to add the ` asciimath-support ` key to your ` book.toml `
50
+ under the ` output.html ` section, in addition to enabling ` mathjax-support ` :
51
+
52
+ ``` toml
53
+ [output .html ]
54
+ mathjax-support = true
55
+ asciimath-support = true
56
+ ```
Original file line number Diff line number Diff line change @@ -490,6 +490,8 @@ pub struct HtmlConfig {
490
490
pub curly_quotes : bool ,
491
491
/// Should mathjax be enabled?
492
492
pub mathjax_support : bool ,
493
+ /// Should asciimath be enabled?
494
+ pub asciimath_support : bool ,
493
495
/// Whether to fonts.css and respective font files to the output directory.
494
496
pub copy_fonts : bool ,
495
497
/// An optional google analytics code.
@@ -550,6 +552,7 @@ impl Default for HtmlConfig {
550
552
preferred_dark_theme : None ,
551
553
curly_quotes : false ,
552
554
mathjax_support : false ,
555
+ asciimath_support : false ,
553
556
copy_fonts : true ,
554
557
google_analytics : None ,
555
558
additional_css : Vec :: new ( ) ,
Original file line number Diff line number Diff line change @@ -681,6 +681,10 @@ fn make_data(
681
681
data. insert ( "mathjax_support" . to_owned ( ) , json ! ( true ) ) ;
682
682
}
683
683
684
+ if html_config. asciimath_support {
685
+ data. insert ( "asciimath_support" . to_owned ( ) , json ! ( true ) ) ;
686
+ }
687
+
684
688
// This `matches!` checks for a non-empty file.
685
689
if html_config. copy_fonts || matches ! ( theme. fonts_css. as_deref( ) , Some ( [ _, ..] ) ) {
686
690
data. insert ( "copy_fonts" . to_owned ( ) , json ! ( true ) ) ;
Original file line number Diff line number Diff line change 50
50
51
51
{{ #if mathjax_support }}
52
52
<!-- MathJax -->
53
+ {{ #if asciimath_support }}
54
+ <script async src =" https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_HTMLorMML" ></script >
55
+ {{ else }}
53
56
<script async src =" https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML" ></script >
54
57
{{ /if }}
58
+ {{ /if }}
55
59
</head >
56
60
<body >
57
61
<div id =" body-container" >
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ edition = "2018"
9
9
10
10
[output .html ]
11
11
mathjax-support = true
12
+ asciimath-support = true
12
13
13
14
[output .html .playground ]
14
15
editable = true
You can’t perform that action at this time.
0 commit comments