很遗憾,无法在语法上实现,只能通过额外的的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://*.com/questions/5014632/how-can-i-parse-a-yaml-file-from-a-linux-shell-script
https://*.com/questions/4425198/can-i-create-links-with-target-blank-in-markdown