Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
2.7k views
in Plugins by
edited by
Is there a way to make the links that are included in the questions or answers of the markdown editor to open in a new page?

 

Edit:

https://github.com/svivian/q2a-markdown-editor
by
I added an edit. Thank you for calling my attention to this important point.

1 Answer

+3 votes
by
selected by
 
Best answer

I haven't actually tested this but if you take a look at file inc.markdown.php you'll find 4 instances of the text <a href= that are not in comments.

You could try turning them into <a target="_blank" href= and see if that gives you the results you want.

by
Thank you! My "href=" are like this

1) $result = "<a href=\"$url\"";
2) $link = "<a href=\"$url\">$url</a>"
3) $addr = "<a href=\"$addr\">$text</a>";

How should I include this?
by
EG:
1) $result = "<a href=\"$url\"";

Should be turned into:
1) $result = "<a target="_blank" href=\"$url\"";
by
Thank you again! This works for questions and answers but not for comments. Is there a way to include this to comments as well?
by
It should work for everything that is posted with the plugin. I bet you have set the basic editor for comments so they don't actually use the markdown plugin. Check the admin/posting section
by
Sorry about that! You are right.
...