我已经结合了MathJax和Markdown标记,因此我需要将所有标记替换$$为,<span>$$</span>以便 Markdown 不会呈现来自 MathJax 的 $$_^... 符号。也\[ \]必须全部替换为<div>\[ \]</div>.
我发现了类似的问题,但这并不是我所需要的。我需要转换这个
This is $some$ math \[equation\] which I $like$.
对此
This is <span>$some$</span> math <div>\[equation\]</div> which I <span>$like$</span>.
可能我需要做的只是在正则表达式中
text = text.replace(/\$.*?\$/g, "meow");
不知何故包括和$$标志(或\[ \]),只是$1将文本嵌入其中<span>$$1$</span>并适应PHP。