Not works if a space near $
$ x = 0 $
Nothing rendered.
This is very much intended, to be consistent with other inline markup.
https://github.com/runarberg/markdown-it-math/blob/master/test/fixtures/default.txt#L21-L26
Reopen. I changed my mind about this. I don‘t think there is a good reason for this restriction. I might rework the scanning to be more like inline-code, where the padded whitespace is optional and trimmed.
Happy to hear that 8 years later! You can just adapt my PR #25 for it!
Released v5.1.0
I created markdown-it-mathspan that follow the same heuristics for math as backticks do for code. That is actually how I like to write markdown, but I think there is too much reliant on the current behavior of this library (the current behavior is also how most other markdown environments behave).
So I added this option as inlineAllowWhiteSpace and default it to false. Note that this is enabled by default in markdown-it-mathspan, just like code spans.