mirror of
https://github.com/xoofx/markdig.git
synced 2026-02-03 21:36:36 +00:00
EmphasisExtraOptions.Strikethrough and EmphasisExtraOptions.Subscript Influence each other #246
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @daxianji007 on GitHub (Nov 26, 2018).
~Subscript~ ~~Strike~~tunrs to<p><sub>Subscript</sub> <del>Strike</del></p>no matter Ichoose .UseEmphasisExtras(EmphasisExtraOptions.Subscript)or.UseEmphasisExtras(EmphasisExtraOptions.Strikethrough)Root cause: they both use
~as opening characters and parser did not distinguish them. I have finished a test case but find it difficult to fix... I just create an issue here first.@xoofx commented on GitHub (Nov 26, 2018):
Yeah, the code is actually not assuming that you can ask one without the other...
6c2702f9fd/src/Markdig/Extensions/EmphasisExtras/EmphasisExtraExtension.cs (L71)I would expect that changing the parameter
1, 2to1, 1only if subscript is asked,2, 2if strikethrough is asked, and1,2if both are asked could work, but not sure (for2, 2never tried)@daxianji007 commented on GitHub (Nov 26, 2018):
Yeah, I have tried the following code:
But it does not work. I find that the maximumCount is actually not used in the parser...
@FranklinWhale commented on GitHub (Jan 15, 2019):
@daxianji007, @xoofx:
I have created a PR (#286) for this issue and incorporated @daxianji007's code into it.
UseEmphasisExtras(EmphasisExtraOptions.Strikethrough)now works as expected butUseEmphasisExtras(EmphasisExtraOptions.Subscript)does not because of the following test case:I tried to add checks for
MaximumCountinc19840d663andea0bf3388fbut neither of them has the intended result.Also, I am not sure whether my expected result,
<p><sub>~test~</sub></p>, is correct.In case
UseEmphasisExtras(EmphasisExtraOptions.Subscript)is hard to fix, can the fix forUseEmphasisExtras(EmphasisExtraOptions.Strikethrough)be merged first?@MihaZupan commented on GitHub (Jan 15, 2019):
@FranklinWhale I believe that for that test case the correct output would be two nested
<sub>tags.~~foo~~=><sub><sub>foo</sub></sub>Same as with nested strong tags
****foo****=><strong><strong>foo</strong></strong>@xoofx commented on GitHub (Jan 15, 2019):
Fixed by #287
@FranklinWhale commented on GitHub (Jan 15, 2019):
Thanks all