erusev/parsedown — pull request #45 by tuxpoldo (2013-12-12 18:00:03+00:00)
Title: Support for links with target="_blank" when not matching against a specified regex

Generally it would be nice, if the parser could recognise if a link is referring the internal site, or something external, in which case the link should open in a new window.

This patch implements the possibility to specify a regular expression in a parser instance (`public $internal_regex`) used for matching internal links. If such a regular expressions specified, than every link is checked against it. If it does not match, than a `target='_blank'` is added to the link markup.

Example:
Using the expression `#(^(http|https)://www\.yeasoft\.(de|com|net|org).*$|^/.*$|^((?!http://).)*$)#` the following URLs are matched as internal:

```
http://www.yeasoft.com
https://www.yeasoft.net/projects:alix
/site/project:btsync-deb
relpath/xyzzy.html
````

The following URLs are recognised as external and will open in a separate window:

```
http://github.com/tuxpoldo
http://www.google.com
```