很遗憾,无法在语法上实现,只能通过额外的的JS代码实现,比如:
var links = document.links; for (var i = 0; i < links.length; i++) { if (!links[i].target) { if ( links[i].hostname !== window.location.hostname || /\.(?!html?)([a-z]{0,3}|[a-zt]{0,4})$/.test(links[i].pathname) ) { links[i].target = ‘_blank‘; } } }
参考:
https://stackoverflow.com/questions/5014632/how-can-i-parse-a-yaml-file-from-a-linux-shell-script
https://stackoverflow.com/questions/4425198/can-i-create-links-with-target-blank-in-markdown
http://www.xuebuyuan.com/2867893.html
原文地址:https://www.cnblogs.com/EasonJim/p/8120521.html
时间: 2024-10-18 07:38:33