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.
相关问题
- Views base64 encoded blob in HTML with PHP
- Is there a way to play audio on a mobile browser w
- HTML form is not sending $_POST values
- implementing html5 drag and drop photos with knock
- React Native Inline style for multiple Text in sin
For completed alex answered (Dec 13 '10)
A more smart injection target could be done with this code :
You could change the regexp exceptions with adding more extension in
(?!html?|php3?|aspx?)
group construct (understand this regexp here: https://regex101.com/r/sE6gT9/3).and for a without jQuery version, check code below:
In my project I'm doing this and it works fine:
Link
But not all parsers let you do that.
Kramdown supports it. It's compatible with standard Markdown syntax, but has many extensions, too. You would use it like this:
Automated for external links only, using GNU sed & make
If one would like to do this systematically for all external links, CSS is no option. However, one could run the following
sed
command once the (X)HTML has been created from Markdown:This can be further automated by adding above
sed
command to amakefile
. For details, see GNUmake
or see how I have done that on my website.With Markdown-2.5.2, you can use this:
I do not agree that it's a better user experience to stay within one browser tab. If you want people to stay on your site, or come back to finish reading that article, send them off in a new tab.
Building on @davidmorrow's answer, throw this javascript into your site and turn just external links into links with target=_blank: