sandbox/sandbox/ MathJax


$hello$ a18f3bb4c9801a8a2d9918f9efd7645abff5095345721e4ad8f7913fa0ec392c6b51d431df5d7f141cbececcf79edf3dd861c3b4069f0b11661a3eefacbba918 $$hello$$ a18f3bb4c9801a8a2d9918f9efd7645abff5095345721e4ad8f7913fa0ec392c7902699be42c8a8e46fbbb4501726517e86b22c56a189f7625a6da49081b2451 a18f3bb4c9801a8a2d9918f9efd7645abff5095345721e4ad8f7913fa0ec392c3fdba35f04dc8c462986c992bcf875546257113072a909c162f7e470e581e278

a18f3bb4c9801a8a2d9918f9efd7645abff5095345721e4ad8f7913fa0ec392c2c624232cdd221771294dfbb310aca000a0df6ac8b66b696d90ef06fdefb64a3

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

a18f3bb4c9801a8a2d9918f9efd7645abff5095345721e4ad8f7913fa0ec392c19581e27de7ced00ff1ce50b2047e7a567c76b1cbaebabe5ef03f7c3017bb5b7

Pt2: protect stuff like the above from everything. We cannot global protect /^a18f3bb4c9801a8a2d9918f9efd7645abff5095345721e4ad8f7913fa0ec392c4a44dc15364204a80fe80e9039455cc1608281820fe2b24f1e5233ade6af1dd5$/ and require that a18f3bb4c9801a8a2d9918f9efd7645abff5095345721e4ad8f7913fa0ec392c4fc82b26aecb47d2868c4efbe3581732a3e7cbcc6c2efb32062c08170a05eeb8. 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);