volca / markdown-preview

Markdown Preview Plus -- Enables Chrome to render markdown files as HTML
https://chrome.google.com/webstore/detail/markdown-preview-plus/febilkbfcbhebfnokafefeacimjdckgl
MIT License
237 stars 72 forks source link

Patch `replaceMathString` to not render math in codes #131

Closed TroyDanielFZ closed 2 years ago

TroyDanielFZ commented 2 years ago

A regex expression to exclude the code tag with the help of look-around operation is not preferred, due to: This is a $x$ to produce $x$, and a $y$ to produce $y$, If we apply the look-around, the first capture will be '$ to produce $', which is not correct Therefore, a simple way, split the src at 'code block', Known bugs: "`$abcd$`" and "\$abcd$\" won't render, actually, I don't hnow what's the espected result.

volca commented 2 years ago

Thanks. I will make a little code format.