mattdipasquale mattdipasquale - 2 months ago 7x
HTML Question

markdown target="_blank"

Is there a way to create a link in markdown that opens in a new window? If not, what syntax do you recommend to do this. I'll add it to the markdown compiler I use. I think it should be an option.


As far as the Markdown syntax is concerned, if you want to get that detailed, you'll just have to use HTML.

<a href="" target="_blank">Hello, world!</a>

Most Markdown engines I've seen allow plain old HTML, just for situations like this where a generic text markup system just won't cut it. (The StackOverflow engine, for example.) They then run the entire output through an HTML whitelist filter, regardless, since even a Markdown-only document can easily contain XSS attacks. As such, if you or your users want to create _blank links, then they probably still can.

If that's a feature you're going to be using often, it might make sense to create your own syntax, but it's generally not a vital feature. If I want to launch that link in a new window, I'll ctrl-click it myself, thanks.