dprint-plugin-markdown icon indicating copy to clipboard operation
dprint-plugin-markdown copied to clipboard

Exclamation point before square brackets is always removed

Open jakebailey opened this issue 2 years ago • 1 comments

Describe the bug

dprint-plugin-markdown version: 0.16.2

I think there's some abiguity here given this syntax is used for markdown images, but when using [^footnote] syntax, placing the footnote directly after an exclamation point without a space (somewhat common for footnotes) causes the exlamation point to be removed from the output.

I'm not totally sure if there's a good resolution here as I'm no markdown syntax expert, but hopefully there's some syntax rule that means that the AST can know that a certain construct isn't an image.

Input Code

Hello, world![^footnote] This is some text.

[^footnote]: This is the footnote.

Expected Output

Hello, world![^footnote] This is some text.

[^footnote]: This is the footnote.

Actual Output

Hello, world[^footnote] This is some text.

[^footnote]: This is the footnote.

https://dprint.dev/playground/#code/BIUwNmD2A0AEDukBOYAmBCA2gPQGaUgBcA7IkAXVgBUALASwGdZHYHIBbEWQkAD0IB0AWABQonPiKke5AFzV6TFoRpdJJMgKA/language/markdown

jakebailey avatar Oct 15 '23 20:10 jakebailey

This is of course easily worked around using \!, so I'm not too unhappy if this isn't fixable... but it does seem odd for non-whitespace characters to just disappear like that. I wouldn't have noticed if I hadn't been watching when I hit save.

jakebailey avatar Oct 15 '23 20:10 jakebailey

I opened https://github.com/pulldown-cmark/pulldown-cmark/issues/923

dsherret avatar Aug 09 '24 23:08 dsherret