Dup Ver Goto 📝

MathJax

PT2/aw/sandbox does not exist
To
33 lines, 128 words, 1149 chars Page 'MathJax' does not exist.

$hello$ \(world\) $$hello$$ \[world\] \($this\)

\[\int_xf(y)\textrm{d}y\]

DEBUG THIS -- closing braces are disappearing. Perhaps require that display math be separated from other text by newlines

\[ f(x)=\left\{begin{array}}[lr] x=0 & \pi\\ \text{otherwise} & sin(x) \end{array}\right. \]

Pt2: protect stuff like the above from everything. We cannot global protect /^\[$.*?^\]$/ and require that \[...\]. as global protected stuff takes precedence over everything else. Thus we protect such blocks, after fenced code blocks, from both WikiWord and Parsedown.

We want a way to specify the pattern and replacement only once. So instead have

$protect_rule = [
  $name => "code blocks",
  $pattern => '@^```.*^```$@s',
  $replacement => function($match) { ... }
];
$protect->add($protect_rule);
$protect_rule = $protect->make_rule($name,$pattern,$replacement);
$protect_rule = $protect->get_rule($name);
$protect_rules = $protect->get_rules(); # all in order
$protect->append_rules(array $protect_rules);
$protect->set_rule($name,$pattern,$replacement);
$protect->add_rule($protect_rule);
$protect->add($name,$pattern,$replacement);