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

Inconsistent strikethrough behavior with different nesting orders of markup #369

Open
Xuanghdu opened this issue Dec 28, 2024 · 1 comment

Comments

@Xuanghdu
Copy link

When combining strikethrough (~~) with other markup, the behavior differs depending on the nesting order.

  • When strikethrough is nested inside, strikethrough renders correctly:

    • **~~a~~**b renders as ab
    • <b>~~a~~</b>b renders as ab
  • When strikethrough wraps other markup, no strikethrough is produced:

    • ~~**a**~~b renders as ~~a~~b
    • ~~<b>a</b>~~b renders as ~~a~~b

However, adding a space after makes it work:

  • ~~**a**~~ b renders as a b
  • ~~<b>a</b>~~ b renders as a b

This inconsistency seems unexpected, as the only difference is whether strikethrough is the outer or inner markup.

Would it be possible to:

  1. Confirm if this different behavior based on nesting order is intended
  2. If not intended, make the behavior consistent
  3. If intended, document this behavior in the GFM spec
@UziTech
Copy link

UziTech commented Dec 28, 2024

To me it is surprising that **~~a~~**b renders as ab because it doesn't work for other inline elements like **_a_**b which renders like **a**b.

It seems like it should render like **a**b. The reason the underscores render like that is because of CommonMark spec's flanking rules

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

No branches or pull requests

2 participants