CodeMirror-MathJax icon indicating copy to clipboard operation
CodeMirror-MathJax copied to clipboard

Support multi-line equations

Open cben opened this issue 12 years ago • 2 comments

E.g.

$$\pi$$ works but

$$ \pi $$ does not.

cben avatar Jul 27 '13 21:07 cben

Explanation: Currently I'm detectiong formulas by a stateless per-line regexp. This made it easy to re-typeset only formulas in lines that were changed but expanding the regexp approach to handle multi-line formulas on change events would be tricky and fragile.

Therefore this is blocked on a rewrite that supports stateful parsing in a clean way - as described in #13.

cben avatar Jan 23 '14 20:01 cben

If I want to exactly replicate what pandoc does for single dollars, it will require lookahead beyond current line:

$20,000 and 
$30,000

is interpreted as text while

$20,000 and 
30,000$

is math. (The real rules for closing $ seems different than documented, with special treatment of numbers. $20,000 and 30,000 $ is still math, an even $20,000 and $b30,000 is math.)

One option is keeping $...$ restricted to one line. In any case (...), $$...$$, [...] will support multi-line.

However, it's not clear that I'm constrained by the fact CodeMirror modes can't lookahead to following line. Math is recognized from change hook which can look everywhere.

cben avatar Apr 04 '14 22:04 cben