feat: revert Blackfriday math workaround + improve Mmark support

Guidance for using math going forward:
- add `markup: mmark` to front matter
- no longer need to escape inline or block math in body

Also, fix Mmark task lists by removing bullet points.
This commit is contained in:
George Cushen committed 2019-07-20 19:43:13 +01:00
1 parent 42932824ba
commit 255b5e8462
2 files changed
+20 -22

No files matched your search

+3 -4
View File
@@ -404,6 +404,9 @@
$('#TableOfContents li').addClass('nav-item');
$('#TableOfContents li a').addClass('nav-link');
// Fix Mmark task lists (remove bullet points).
$("input[type='checkbox'][disabled]").parents('ul').addClass('task-list');
// Fix Mermaid.js clash with Highlight.js.
let mermaids = [];
[].push.apply(mermaids, document.getElementsByClassName('language-mermaid'));
@@ -472,10 +475,6 @@
// Re-initialize Scrollspy with dynamic navbar height offset.
fixScrollspy();
// Fix inline math (workaround lack of Mathjax support in Blackfriday).
// Note `.MathJax_Preview` won't exist until after Mathjax has parsed the page, so call on page *load*.
$('.MathJax_Preview').unwrap('code');
if (window.location.hash) {
// When accessing homepage from another page and `#top` hash is set, show top of page (no hash).
if (window.location.hash == "#top") {
+17 -18
View File
@@ -3,6 +3,7 @@ title: Writing technical content in Academic
date: 2019-07-12
math: true
diagram: true
markup: mmark
---
Academic is designed to give technical content creators a seamless experience. You can focus on the content and Academic handles the rest.
@@ -33,36 +34,24 @@ data.head()
### Math
Academic supports a Markdown extension for $\LaTeX$ math. You can enable this feature by toggling the `math` option in your `config/_default/params.toml` file or by adding `math: true` to your page front matter.
Academic supports a Markdown extension for $\LaTeX$ math. You can enable this feature by toggling the `math` option in your `config/_default/params.toml` file and adding `markup: mmark` to your page front matter.
To render a math *block*, wrap your LaTeX math with
<div>$$...$$</div>
whereas to render *inline* math, wrap your LaTeX math with backticks
`$...$`
otherwise your math will be parsed as Markdown.
To render *inline* or *block* math, wrap your LaTeX math with `$$...$$`.
Example math block:
```html
<div>$$
\gamma_{n} = \frac{
```tex
$$\gamma_{n} = \frac{
\left | \left (\mathbf x_{n} - \mathbf x_{n-1} \right )^T
\left [\nabla F (\mathbf x_{n}) - \nabla F (\mathbf x_{n-1}) \right ] \right |}
{\left \|\nabla F(\mathbf{x}_{n}) - \nabla F(\mathbf{x}_{n-1}) \right \|^2}
$$</div>
{\left \|\nabla F(\mathbf{x}_{n}) - \nabla F(\mathbf{x}_{n-1}) \right \|^2}$$
```
renders as
<div>
$$\gamma_{n} = \frac{ \left | \left (\mathbf x_{n} - \mathbf x_{n-1} \right )^T \left [\nabla F (\mathbf x_{n}) - \nabla F (\mathbf x_{n-1}) \right ] \right |}{\left \|\nabla F(\mathbf{x}_{n}) - \nabla F(\mathbf{x}_{n-1}) \right \|^2}$$
</div>
Example inline math `\left \|\nabla F(\mathbf{x}_{n}) - \nabla F(\mathbf{x}_{n-1}) \right \|^2` renders as `$\left \|\nabla F(\mathbf{x}_{n}) - \nabla F(\mathbf{x}_{n-1}) \right \|^2$`.
Example inline math `$$\left \|\nabla F(\mathbf{x}_{n}) - \nabla F(\mathbf{x}_{n-1}) \right \|^2$$` renders as $$\left \|\nabla F(\mathbf{x}_{n}) - \nabla F(\mathbf{x}_{n-1}) \right \|^2$$ .
### Diagrams
@@ -180,4 +169,14 @@ renders as
| Content Cell | Content Cell |
| Content Cell | Content Cell |
### Asides
```markdown
A> A Markdown aside is equivalent to using the Alert Shortcode, but simpler to use.
```
renders as
A> A Markdown aside is equivalent to using the Alert Shortcode, but simpler to use.
### Did you find this page helpful? Consider sharing it 🙌