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

Require double-tilde for strikethrough #33

Merged
merged 2 commits into from
Oct 12, 2024
Merged

Conversation

yihui
Copy link
Contributor

@yihui yihui commented Oct 11, 2024

In Pandoc's Markdown, single tilde is for subscripts, e.g., H~2~O. GFM allows for both ~ and ~~ for strikethroughs, which I think is a really bad idea (cf jgm's first pain: https://johnmacfarlane.net/beyond-markdown.html).

@jeroen
Copy link
Member

jeroen commented Oct 12, 2024

I'm a bit uncertain if we should change the default or introduce an option for this. It is a breaking change and many people are used to the single-tilde strikethrough but on the other hand having too many option is annoying too. I wish we had enabled this from the beginning.

@jeroen jeroen merged commit 91237d4 into r-lib:main Oct 12, 2024
8 checks passed
@jeroen
Copy link
Member

jeroen commented Oct 12, 2024

Let's try it and see if it breaks anything.

@yihui yihui deleted the double-tilde branch October 13, 2024 03:50
yihui added a commit to rstudio/shiny that referenced this pull request Oct 13, 2024
The current dev version of commonmark has disabled single tilde   for strikethrough: r-lib/commonmark#33 Using double-tilde will make it consistent with Pandoc's Markdown (where single-tilde is for subscripts).
@yihui
Copy link
Contributor Author

yihui commented Oct 13, 2024

I ran revdep checks and found that it would break a shiny test (all other revdeps are fine). I've submitted a PR to shiny: rstudio/shiny#4144 Let's see if they will merge it.

This is indeed a breaking change, and we can provide an option instead, but I don't like too many options, either.

cpsievert added a commit to rstudio/shiny that referenced this pull request Oct 15, 2024
* Use double-tilde for strikethrough in Markdown tests

The current dev version of commonmark has disabled single tilde   for strikethrough: r-lib/commonmark#33 Using double-tilde will make it consistent with Pandoc's Markdown (where single-tilde is for subscripts).

* Skip tests if commonmark is outdated

* Revert "Skip tests if commonmark is outdated"

This reverts commit 97bee20.

---------

Co-authored-by: Carson Sievert <cpsievert1@gmail.com>
@yihui
Copy link
Contributor Author

yihui commented Oct 15, 2024

The shiny PR has been merged. commonmark needs to wait for the next CRAN release of shiny before its new CRAN release (unless we add an option like single_tilde_strikethrough = TRUE for backward compatibility).

@zkamvar
Copy link

zkamvar commented Oct 16, 2024

This now means that the single tilde does not survive the round trip (as discussed in an earlier attempt to enforce the double tilde: #31 (comment)).

Is there something we can do to prevent this?

@yihui
Copy link
Contributor Author

yihui commented Oct 16, 2024

Oh I didn't realize that you had already tried to do what I did.

Good question, and I don't know the answer. In the long run, personally I feel it may be a better idea to detach this R package from GFM, because Github clearly doesn't have interest in catering to the needs of anyone outside Github. From github/cmark-gfm#71 (comment)

these extensions are for our own use

I totally understand why they wanted to keep single-tilde, but this legacy really makes no sense outside Github.

By "detaching", I don't mean that we completely ignore GFM's future changes (I guess they would be relatively minor anyway), but applying patches the other way around. That is, instead of applying our patches to GFM's codebase, we apply GFM's patches to our codebase. Of course, this may require more maintenance effort...

If we dare to deviate from GFM, the round trip problem may be solved by introducing the subscript syntax formally in our own spec, although I have no idea how hard the C implementation would be.

yihui added a commit to yihui/litedown that referenced this pull request Oct 16, 2024
@zkamvar
Copy link

zkamvar commented Oct 16, 2024

If we dare to deviate from GFM, the round trip problem may be solved by introducing the subscript syntax formally in our own spec, although I have no idea how hard the C implementation would be.

That's a good question. I would be willing to spend a little time digging into it. I would imagine it wouldn't be too dissimilar to the patch for the footnotes, considering there already is a mechanism to explicitly enforce the double tilde/single tilde.

@zkamvar
Copy link

zkamvar commented Oct 16, 2024

I played around with it this afternoon and was able to get something working by duplicating the extensions/strikethrough.{c,h} files, modifying the logic and outputs slightly, and including subscript.h in core-extensions, Makevars, and table.h

I'm not sure how to format it as a patch, tho.

@zkamvar zkamvar mentioned this pull request Oct 16, 2024
14 tasks
@yihui
Copy link
Contributor Author

yihui commented Oct 17, 2024

Awesome! Perhaps send a PR and we can discuss the possibility of turning that into a maintainable patch from there?

@zkamvar
Copy link

zkamvar commented Oct 18, 2024

#35

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

Successfully merging this pull request may close these issues.

3 participants