views:

24

answers:

1

Hey,

I'd like to have a link generated with BlueCloth that opens in a new window. All I could find was the ordinary [Google](http://www.google.com/) syntax but nothing with a new window.

Ideas?

Regards

Tom

A: 

Here is a complete reference for markdown: http://daringfireball.net/projects/markdown/syntax

And since there is no mention of how to set the target attribute, I would believe it is not directly possible, but the reference also says:

For any markup that is not covered by Markdown’s syntax, you simply use HTML itself. There’s no need to preface it or delimit it to indicate that you’re switching from Markdown to HTML; you just use the tags.

Source: http://daringfireball.net/projects/markdown/syntax#html

So I would suggest you have to use the html syntax for links like this

update

if you wrap the markdown generated content in a div with a specific id like this:

and you use jQuery, you can add the following javascript:

$('#some_id a').attr('target','_blank');

Or you can save the BlueCloth output in a variable before outputting.

markdown_generated_string.gsub!(/<a\s+/i,'<a target="_blank" ')
jigfox
I am using `:escape_html => true`, so that is not possible. I don't want the user to type plain html, I wouldn't need markdown for that. :\
Tom
See my update: You can manipulate it vie javascript after rendering or via ruby before rendering.
jigfox