Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Single-tilde strikethrough not recognized by org.commonmark.ext.gfm.strikethrough extension #267

Closed
davidkwlam opened this issue Sep 12, 2022 · 2 comments
Labels

Comments

@davidkwlam
Copy link

Steps to reproduce the problem (provide example Markdown if applicable):

This is a GFM ~strikethrough~

Expected behavior:

<p>This is a GFM <del>strikethrough</del></p>

Actual behavior:

<p>This is a GFM ~strikethrough~</p>

Notes:

This works fine with double tilde: This is a GFM ~~strikethrough~~ is correctly parsed to <p>This is a GFM <del>strikethrough</del></p>. I'm passing a StrikethroughExtension instance to both the parser and html renderer.

GitHub flavoured markdown supports both double and single tilde strikethrough:

~single tilde strikethrough~: single tilde strikethrough
~~double tilde strikethrough~~: double tilde strikethrough

Thank you for all your hard work!

@davidkwlam davidkwlam added the bug label Sep 12, 2022
@robinst
Copy link
Collaborator

robinst commented Oct 18, 2022

Hi, you're right. Looks like GitHub only recently (August 2022) changed the wording in their spec, from:

Strikethrough text is any text wrapped in two tildes (~).

To:

Strikethrough text is any text wrapped in a matching pair of one or two tildes (~).

That's a bit annoying. I would normally be hesitant to change behavior of syntax like this now, but given that the aim of the extension is to be compatible with GitHub, I think we should do it anyway. Hopefully no one relies on the previous behavior of single tildes. If they do we can make the behavior configurable via an option later.

robinst added a commit that referenced this issue Oct 19, 2022
Adjust GFM strikethrough parsing (fixes #267)
@robinst
Copy link
Collaborator

robinst commented Oct 20, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants