How to replace $x<y$ with $x < y$
fardina opened this issue · comments
fardina commented
I am using cebe markdown in my website for writing mathematics.
If I use less than sign it causes some problems in rendering mathjax, see here: http://docs.mathjax.org/en/latest/tex.html#tex-and-latex-in-html-documents
How can I search all the text for less than sign like "x<y" and replace it by "x < y"?
Thank you for your help
Carsten Brandt commented
how is that question related to this library? do you have a parsing method that handles your math syntax?
Alexander Makarov commented
Do this right before passing your text to markdown library:
$text = preg_replace('~([a-z0-9]+)([<>=+-])([a-z0-9]+)~', '\1 \2 \3', $text);