Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

How to make the links of the markdown editor to open in a new page?

+2 votes
1,292 views
asked Jun 14, 2015 in Plugins by gunrose
edited Jun 14, 2015 by gunrose
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
commented Jun 14, 2015 by gunrose
I added an edit. Thank you for calling my attention to this important point.

1 Answer

+3 votes
answered Jun 14, 2015 by pupi1985
selected Jun 15, 2015 by gunrose
 
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.

commented Jun 15, 2015 by gunrose
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?
commented Jun 15, 2015 by pupi1985
EG:
1) $result = "<a href=\"$url\"";

Should be turned into:
1) $result = "<a target="_blank" href=\"$url\"";
commented Jun 15, 2015 by gunrose
Thank you again! This works for questions and answers but not for comments. Is there a way to include this to comments as well?
commented Jun 15, 2015 by pupi1985
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
commented Jun 15, 2015 by gunrose
Sorry about that! You are right.
...