A Suggestion for Strikethrough Syntax

Bill Eccles Bill.lists at Eccles.net
Wed Nov 4 18:06:19 EST 2009


All,

Hopefully, I'm not covering old territory, and a search of the list
archives seems to indicate that I'm not. If I am, then I extend my
apologies in advance.

I use strikethrough a lot so I modify my Movable Type Markdown module
as shown below, right about line 1040 or so. I assume other Markdown
implementations can use this change as well:

sub _DoItalicsAndBold {
my $text = shift;

# <strong> must go first:
$text =~ s{ (\*\*|__) (?=\S) (.+?[*_]*) (?<=\S) \1 }
{<strong>$2</strong>}gsx;

$text =~ s{ (\*|_) (?=\S) (.+?) (?<=\S) \1 }
{<em>$2</em>}gsx;

# These lines added by Bill Eccles, 2008-07-04
$text =~ s{ (\s) (-) (?=\S) (.+?) (?<=\S) (-) }
{$1<strike>$3</strike>}gsx;

return $text;
}

It converts

-text to be struck through-

to

<strike>text to be struck through</strike>.

Simple, and it works for me.

(I detail it at <http://www.bill.eccles.net/bills_words/2008/07/a-test-entry-with-markdownstri.html
>.)

Thoughts?

/Bill
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://six.pairlist.net/pipermail/markdown-discuss/attachments/20091104/b3da8eba/attachment.html>


More information about the Markdown-Discuss mailing list