Feature Request: Strikethrough text

I cannot see this functionality in the spec. The HTML output would obviously be <del></del>

7 Likes

Here’s a draft of an extension to do that, in the format I’ve been throwing around:

Extension: Strikethrough

A new inline Markdown element is added, Strikethrough. It follows the same parsing rules as strong emphasis (§6.4), except that the asterisk and underline are replaced by a tilde ~, and the <strong> tag is replaced with the <del> tag.

A double ~~ can open strikethrough iff

  1. it is not part of a sequence of 3 or more unescaped ~s, and
  2. it is not followed by whitespace.

A double ~~ can close strikethrough iff

  1. it is not part of a sequence of 3 or more unescaped ~s, and
  2. it is not preceded by whitespace.

Strikethrough has a precedence equal to emphasis and strong emphasis.

OK. I think ~ is better than - that is used in for instance in JIRA (-some deleted text-) as it is a less common character used in general language.

3 Likes

A very nice feature indeed, and available in Trello: https://trello.com/c/lzWiUQYd/1496-add-strikethrough

That extension draft looks really interesting, but I have to ask, do you have a matching draft for the ins element? It seems strange to implement only half of what is needed to “represent edits to the document” (as the HTML Standard describes ins and del).

Unless you are not really talking about actual edits but only a way to mark text as “no longer accurate or no longer relevant”, in which case the s element should be used.

Has anyone (@riking) considered how CriticMarkup would work together with SMD? They have addition and deletion covered, which would open-up ~~ for use with the s element for an actual HTML strikethrough equivalent.

1 Like

Yeah, I was just going to say, this is more useful if paired with a syntax for <ins>. ++new text++ maybe?

My intent was to come up with something that describes how Reddit and GitHub currently do strikethrough – in other words, to describe what’s already happening (just like the rest of the spec).

On GitHub, strikethrough uses the <del> tag so I used that here, too.

Duplicate of

http://talk.commonmark.org/t/strikeout-threw-out-strikethrough-strikes-out-throughout/820

This topic is now closed. New replies are no longer allowed.