sandbox/sandbox/ MathJax


$hello$ 076ebb5fa07d7a1d7afcc6bbc0381b54ef772583510f947019d9a9c533c7cf136b51d431df5d7f141cbececcf79edf3dd861c3b4069f0b11661a3eefacbba918 $$hello$$ 076ebb5fa07d7a1d7afcc6bbc0381b54ef772583510f947019d9a9c533c7cf137902699be42c8a8e46fbbb4501726517e86b22c56a189f7625a6da49081b2451 076ebb5fa07d7a1d7afcc6bbc0381b54ef772583510f947019d9a9c533c7cf133fdba35f04dc8c462986c992bcf875546257113072a909c162f7e470e581e278

076ebb5fa07d7a1d7afcc6bbc0381b54ef772583510f947019d9a9c533c7cf132c624232cdd221771294dfbb310aca000a0df6ac8b66b696d90ef06fdefb64a3

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

076ebb5fa07d7a1d7afcc6bbc0381b54ef772583510f947019d9a9c533c7cf1319581e27de7ced00ff1ce50b2047e7a567c76b1cbaebabe5ef03f7c3017bb5b7

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