【hexo】markdown超链接样式

样式

1
2
3
4
5
6
7
8
9
.posts-expand .post-body,.post-copyright {
a:not(.btn) {
color: #0269C8;
border-bottom: 1px solid #D1E9FF;
}
a:not(.btn):hover {
color: #275B8C;
}
}

新页面打开

打开工程目录\themes\next\source\js\src\utils.js,添加如下代码。

1
2
3
4
5
6
7
8
9
10
11
12
13
$(document).ready(function(){
// 超链接在新页面打开
var links = $('.posts-expand .post-body a:not(.btn):not(.headerlink)');
links.each(function() {
var href_str = $(this).attr('href');
if (!href_str || href_str.length <= 0 || href_str[0] != '#')
{
var text_str = $(this).text();
$(this).attr('target', '_blank');
$(this).attr('id', text_str);
}
});
});

即增加target 属性的值为_blank