markdown-it-math icon indicating copy to clipboard operation
markdown-it-math copied to clipboard

Not works if a space near $

Open Menci opened this issue 8 years ago • 3 comments

$ x = 0 $

Nothing rendered.

Menci avatar Jan 26 '17 15:01 Menci

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

runarberg avatar Jan 30 '17 03:01 runarberg

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.

runarberg avatar Mar 05 '25 19:03 runarberg

Happy to hear that 8 years later! You can just adapt my PR #25 for it!

Menci avatar Mar 19 '25 06:03 Menci

Released v5.1.0

runarberg avatar Mar 21 '25 01:03 runarberg

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.

runarberg avatar Mar 21 '25 02:03 runarberg