zed icon indicating copy to clipboard operation
zed copied to clipboard

Support rendering strikethrough text in markdown

Open bennetbo opened this issue 4 months ago • 1 comments

Just noticed strikethrough text handling was not implemented for the following:

Chat image

Markdown Preview image

Code Documentation image

It looks like there are three different markdown parsing/rendering implementations, might be worth to investigate if any of these can be combined into a single crate (looks like a lot of work though).

Release Notes:

  • Added support for rendering strikethrough text in markdown elements

bennetbo avatar Feb 23 '24 17:02 bennetbo

@SomeoneToIgnore looks like pulldown_cmark handles the parsing differently then GitHub. Take a look at this example:

Nested Italic

Text: 
**as*teri*sks**

Parser output:
Start(Paragraph)
Start(Strong)
Text(Borrowed("as"))
Start(Emphasis)
Text(Borrowed("teri"))
End(Emphasis)
Text(Borrowed("sks"))
End(Strong)
End(Paragraph)

Nested Strikethrough

Text: 
**as~~teri~~sks**

Parser output:
Start(Paragraph)
Start(Strong)
Text(Borrowed("as~~teri~~sks"))
End(Strong)
End(Paragraph)

As you can see the parser picks up the nested italic, but not the nested strikethrough. I'll take some more time to look into this.

bennetbo avatar Feb 25 '24 16:02 bennetbo

Looks like it was fixed in the 0.10.x version of pulldown-mark. I'll try to upgrade the dependency

bennetbo avatar Feb 26 '24 17:02 bennetbo

Here is what it looks like now: image

I cannot spot a difference to the GitHub one, other than the line breaks at the last few lines (which is not a regression).

I'll make sure to add a test to markdown parser for the nested case.

bennetbo avatar Feb 26 '24 17:02 bennetbo