Bookmarklet link in Markdown document
bookmarklet, markdown
Solution
Markdown will leave any HTML alone, so you can just enter
<a href="javascript:function my_bookmarklet()
{alert('Hello World');}
my_bookmarklet();">Hello</a>
and get Hello. Edit: No longer works on SO, which is a good thing
You can also escape special characters with a backslash (in this case it's seeing the ")"s in your Javascript as the end of the URL) and the link syntax will work:
[Hello](javascript:function my_bookmarklet(\){alert('Hello World'\);}my_bookmarklet(\);)
gives [Hello](javascript:function my_bookmarklet(){alert('Hello World');}my_bookmarklet();)
Problem
How can I include a bookmarklet in a Markdown parsed document? Is there any "tag" for markdown that basically says "don't parse this"?? For example you could have something like: ``` <a href="javascript:function my_bookmarklet() {alert('Hello World');} my_bookmarklet();">Hello</a> ``` But if I try to past the javascript from that into a link in markdown like this: ``` [Hello World!](javascript:function my_bookmarklet(){alert('Hello World');}my_bookmarklet();) ``` You get a messed up link, like below. [Hello World!](javascript:function my_bookmarklet(){alert('Hello World');}my_bookmarklet();) Is there anyway around this? And no, I'm not trying to put malicious bookmarklets in SO or anything, but I want to use markdown for my site and would like to post some bookmarklets I wrote. Edit: I thought I had the answer...but now it seems I don't quite have it. This seems to work great in WMD and showdown, but in the Markdown.php editor, it does not. Anyone have experience with Markdown.php specifically?