markdig icon indicating copy to clipboard operation
markdig copied to clipboard

Single `+` in superscript or subscript

Open geoffreymcgill opened this issue 1 year ago • 1 comments

We ran into a very specific scenario using a + in superscript or subscript that appears to fail parsing correctly.

Sample 1

Superscript^+^ or Subscript~+~

The above renders as...

Screen Shot 2024-04-16 at 11 09 26 AM

Sample 2

If a space is added before the ^+^, then it parses correctly:

Superscript ^+^ or Subscript ~+~

The above renders as...

Screen Shot 2024-04-16 at 11 09 35 AM

Sample 3

Interestingly, using ^+^ also fails:

Superscript^+^ or Subscript~+~

The above renders as...

Screen Shot 2024-04-16 at 11 09 40 AM

The parsing issue only happens when using a single + char. If revised to a - char, then the subscript and subscript parse and render correctly.

Can anyone else reproduce?

Hope this helps.

geoffreymcgill avatar Apr 16 '24 17:04 geoffreymcgill

It is reproduced here

I would believe it is a bug but don't have personal time dedicated to fix it, so PR welcome if someone is motivated. Not entirely sure that the fix is easy, as the parsing of the matching opening/closing super/sub scripts might be reusing the same rules that we use for bold/italic, and these rules are quite strict (e.g need a space before and after the opening/closing braces)

xoofx avatar Jun 14 '24 04:06 xoofx