代码: 全选
case CommonMark_Element_InlineElement::TYPE_LINK:
$attrs['href'] = $this->escape($inline->getAttribute('destination'), true);
if ($title = $inline->getAttribute('title')) {
$attrs['title'] = $this->escape($title, true);
}
return $this->inTags('a', $attrs, $this->renderInlines($inline->getAttribute('label')));
这就是输出超级链接的部分,只要添加一行$attrs['target'] = '_blank';即可
将这一段修改为:
代码: 全选
case CommonMark_Element_InlineElement::TYPE_LINK:
$attrs['href'] = $this->escape($inline->getAttribute('destination'), true);
if ($title = $inline->getAttribute('title')) {
$attrs['title'] = $this->escape($title, true);
}
$attrs['target'] = '_blank'; #这就是添加的那一行代码
return $this->inTags('a', $attrs, $this->renderInlines($inline->getAttribute('label')));
效果见:http://boo.ooo/o11/