This change only surrounds the text with markdown inline styles and preserves
the whitespace, but doesn't attempt to style it, fixing the issue of
incompatibility with markdown parsers.
I'm not super confident about the efficiency of my regular expression here. It works, but I am worried that it is not optimal. Perhaps someone with better regex-fu will know if it can be improved performance-wise.
If you test out markdown on a gist, markdown like this:
(with trailing or leading whitespace) is not properly parsed. (examples here: https://gist.github.com/Rosey/3f848d77b46f7ab337a53211117acd87)
This change only surrounds the text with markdown inline styles and preserves the whitespace, but doesn't attempt to style it, fixing the issue of incompatibility with markdown parsers.
I'm not super confident about the efficiency of my regular expression here. It works, but I am worried that it is not optimal. Perhaps someone with better regex-fu will know if it can be improved performance-wise.