goessner / markdown-it-texmath

Support TeX math equations with your Markdown documents.
MIT License
161 stars 29 forks source link

Is there a reason whitspace is disallowed for inline math? #21

Closed bruce2142 closed 3 years ago

bruce2142 commented 4 years ago

I like having a space as padding within the math environment. Ex: $ 2 $ instead of $2$. I think it looks nicer and (more importantly) it lets me use VS Code user snippets in there. Is there a reason this is disallowed? Could you add \s? to the regex or is it more complicated than that? I could have sworn whitespace worked when I used mdmath a year ago, but I couldn't find anything in the changelog.

goessner commented 3 years ago

Reason for disallowing inline math enclosed by "$"'s beginning and ending with spaces, primarily is to avoid conflicts with "$"'s occuring in normal text, as in: ... costs 20$ or $30 ....

thanks