Closed hexiaochen666 closed 1 year ago
import iterator from 'markdown-it-for-inline'
.use(iterator, 'url_new_win', 'link_open', function (tokens, idx) {
var aIndex = tokens[idx].attrIndex('target');
if (aIndex < 0) {
tokens[idx].attrPush(['target', '_blank']);
} else {
tokens[idx].attrs[aIndex][1] = '_blank';
}
})
不如直接写标签 方法1:
<base target="_blank"/>
方法2:
<a target="_blank" href="xxxxx">xxxx</a>
取决于你所使用的渲染器,与编辑器无关
怎么样能让渲染出来的a标签在新的窗口打开?