|
5 | 5 | window.markdownitrules = function(mdit) { |
6 | 6 | "use strict"; |
7 | 7 |
|
8 | | - mdit.renderer.rules.math_inline = function(tokens, idx) { |
| 8 | + mdit.renderer.rules.code_inline = function(tokens, idx) { |
9 | 9 | const code = tokens[idx].content; |
10 | 10 | const latexwrap = (s) => `\\(${s}\\)`; |
11 | 11 | return latexwrap(window.AMparseMath(code, true)); |
12 | 12 | }; |
13 | 13 |
|
14 | | - // This is three backticks: ```....```. |
15 | | - mdit.renderer.rules.math_block = function(tokens, idx) { |
16 | | - // Interpret each line as an ASCIIMath expression, and convert to LaTeX displayed equations. |
17 | | - //const asciimathparser = window.asciimath.parseMath; |
| 14 | + mdit.renderer.rules.math_inline = function(tokens, idx) { |
| 15 | + const code = tokens[idx].content; |
| 16 | + const latexwrap = (s) => `\\(${s}\\)`; |
| 17 | + return latexwrap(code); |
| 18 | + }; |
18 | 19 |
|
| 20 | + mdit.renderer.rules.math_block = function(tokens, idx) { |
19 | 21 | var code = tokens[idx].content; |
20 | 22 | // Split, trim, remove empty lines, parse, wrap, and join. |
21 | 23 | const processed = code.split(/\r?\n/) // Split by newlines. |
22 | 24 | .map(line => line.trim()) // Trim whitespace. |
23 | 25 | .filter(line => line !== "") // Remove empty lines. |
24 | | - .map(line => latexwrap(window.AMparseMath(line, true))); // Apply parse and wrap. |
| 26 | + .map(line => latexwrap(line)); // Apply parse and wrap. |
25 | 27 | return `\\[\\begin{align*}\n` + processed.join('\n') + `\n\\end{align*}\\]\n`; |
26 | 28 |
|
27 | 29 | }; |
|
0 commit comments