markdown-it / markdown-it-sup

Superscript (<sup>) tag plugin for markdown-it markdown parser
https://markdown-it.github.io/
MIT License
24 stars 18 forks source link

whitespace breaks "sup" parsing #3

Closed dajare closed 4 years ago

dajare commented 4 years ago

I see from the README that "nested markup is currently not supported" (also on markdown-it-sub). But it did surprise me that "whitespace" breaks the parsing:

But with tab or space, the superscript fails. I see this:

[That last example with space (U+0020) of course. I haven't tested other kinds of "whitespace".]

Is this by design? It seems counter-intuitive if markdown-it-sup is extending the feature set by adding <sup>...</sup> equivalence. (And it seems the same is also true of markdown-it-sub, but I haven't posted this there.)

puzrin commented 4 years ago

Yes, it's by design, because official spec not exists and nobody knows how it should work (too many collisions possible).

Workaround is to use escaping via backslash: ^up\ up^

Consider sub/sup as "something simplified you can use without guarantees".

dajare commented 4 years ago

Thanks for that helpful (and quick!) reply. So this will be a sensible "won't fix", but good to have the workaround documented.

And that "consideration" makes good sense to me! Thanks again.

puzrin commented 4 years ago

You can make PR if you wish. I don't remember details about addons after those landed.

Also, can try to ping sub/sup spec actrivity on commonmark forum (but, to be honest, i don't beleive it helps in reasonable future).