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>
+++ Bill Eccles [Nov 04 09 18:06 ]:> 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. > > It converts > > -text to be struck through- > > to > > <strike>text to be struck through</strike>. > > Simple, and it works for me.Pandoc uses this syntax in its markdown extensions: ~~text to be struck through~~ http://johnmacfarlane.net/pandoc/README.html#strikeout One advantage of this over your proposal is that it doesn't require a leading space, which is useful for edits and occasionally other things (e.g. when you want to strike out the first word of a text): apol~~l~~ogies syntactic~~al~~ ~~Dear Colleagues:~~To whom it may concern: It also allows e.g. hyphenated words in struck-through text: ~~permutation-invariant~~ Now that it's been in pandoc for a while, I'd be reluctant to change this syntax, but it now strikes me that something like the following would look better: apol(~l~)ogies syntactic(~al~) (~permutation-invariant~) John
> Pandoc uses this syntax in its markdown extensions: > > ~~text to be struck through~~8< snip!> > Now that it's been in pandoc for a while, I'd be reluctant > to change this syntax, but it now strikes me that something > like the following would look better: > > apol(~l~)ogies > syntactic(~al~) > (~permutation-invariant~) > > JohnActually, I like your double-tilde notation a lot better than my hyphen notation. It accomplishes much better what John set out to do, namely make something that looks like what it represents. And a tilde does look a lot like a scribble, which is a lot like what a strikethrough represents. I don't much care for the parenthesis-laden notation, though. Doesn't quite look like what it represents as much as the double-tilde does. I'd love to see Pandoc integrated with Movable Type. That'd be sweeeeeeet. /Bill