parent
41567b0456
commit
9c55840ca8
|
@ -99,6 +99,7 @@ default-theme = "light"
|
|||
preferred-dark-theme = "navy"
|
||||
curly-quotes = true
|
||||
mathjax-support = false
|
||||
asciimath-support = false
|
||||
copy-fonts = true
|
||||
additional-css = ["custom.css", "custom2.css"]
|
||||
additional-js = ["custom.js"]
|
||||
|
@ -126,6 +127,8 @@ The following configuration options are available:
|
|||
that occur in code blocks and code spans. Defaults to `false`.
|
||||
- **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,
|
||||
|
|
|
@ -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 <kbd>\\\`...\\\`</kbd>.
|
||||
|
||||
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
|
||||
```
|
|
@ -490,6 +490,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.
|
||||
|
@ -550,6 +552,7 @@ impl Default for HtmlConfig {
|
|||
preferred_dark_theme: None,
|
||||
curly_quotes: false,
|
||||
mathjax_support: false,
|
||||
asciimath_support: false,
|
||||
copy_fonts: true,
|
||||
google_analytics: None,
|
||||
additional_css: Vec::new(),
|
||||
|
|
|
@ -681,6 +681,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));
|
||||
|
|
|
@ -50,8 +50,12 @@
|
|||
|
||||
{{#if mathjax_support}}
|
||||
<!-- MathJax -->
|
||||
{{#if asciimath_support}}
|
||||
<script async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_HTMLorMML"></script>
|
||||
{{else}}
|
||||
<script async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
</head>
|
||||
<body>
|
||||
<div id="body-container">
|
||||
|
|
|
@ -9,6 +9,7 @@ edition = "2018"
|
|||
|
||||
[output.html]
|
||||
mathjax-support = true
|
||||
asciimath-support = true
|
||||
|
||||
[output.html.playground]
|
||||
editable = true
|
||||
|
|
Loading…
Reference in New Issue