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

Strikethrough extension fails if first character within delimiters is punctuation #483

Closed
jmooring opened this issue Dec 21, 2024 · 3 comments
Labels

Comments

@jmooring
Copy link
Contributor

jmooring commented Dec 21, 2024

A better description...

The strikethrough extension fails if (a) the first character within the delimiters is punctuation, and (b) the character preceding the opening delimiter is either a letter or a number.

Tested with [email protected] playground

Markdown:

K~1~

K~*1~

Expected:

<p>K<del>1</del></p>
<p>K<del>*1</del></p>

Actual:

<p>K<del>1</del></p>
<p>K~*1~</p>

From the specifications (emphasis mine):

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

However, note that GitHub has the same problem. The example above rendered by GitHub:

K1

K~*1~

@jmooring jmooring changed the title Strikethough extension fails if first character within delimiters is punctuation Strikethrough extension fails if first character within delimiters is punctuation Dec 21, 2024
@yuin
Copy link
Owner

yuin commented Dec 22, 2024

This kind of extensions are implemented as same as the emphasis. CommonMark emphasis algorithm is known for complicated and having many edge cases. Espacially the emphasis algorighm is basically designed for sentences written in Western language(that is separated by spaces), other situations like CJK sentences and math often fail.

I think that GFM spec writes spec wrong(Aside from whether CommonMark emphasis algorithm is good or bad)

Copy link

This issue is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale label Jan 21, 2025
@yuin
Copy link
Owner

yuin commented Jan 30, 2025

Closing for now. Free to reopen.

Note: goldmark have a workaround for this CommonMark spec issue. With CJK extension, you can insert 'escaped'(and invisible) spaces like

K\ _-1_

playground link

Inserting escaped spaces before and/or after a target string resolves this issue.

@yuin yuin closed this as completed Jan 30, 2025
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