
剑去主题
出售B2子主题,限时促销!请直接去授权中心购买。
![图片[1]-给B2自带的代码高亮增加一键复制功能【完美方案】-剑去主题 - 子比美化、B2美化、B2子主题!](https://www.swordgo.cn/wp-content/uploads/2024/12/6f292cd8e820250528073547.jpg)
编辑b2/Assets/fontend/single.js
,在最上方插入以下代码。
编辑b2/Assets/fontend/single.js
,搜索prettyPrint()
,在下方插入以下代码
CSS加入代码(限定最大高数、带滚动条、代码超出自动换行)
/*代码高亮美化开始*/
.entry-content pre:after {
content: '';
position: absolute;
top: 0;
left: 0;
width: 15px;
height: 15px;
border-radius: 50%;
background: #fc625d;
margin: 15px 25px;
}
.sticky-button {
position: -webkit-sticky;
position: sticky;
top: 0;
left:100%;
font-size:16px;
background: var(--b2color);
color: #fff;
border: none;
padding: 5px 10px;
border-radius: var(--b2radius);
cursor: pointer;
}
.entry-content pre {
position: relative;
border-radius: 6px;
padding-top: 50px;
box-shadow: 0px 8px 20px -10px #000;
}
.entry-content pre code, .content-show-roles pre code{
white-space: pre-wrap!important;
}
.entry-content pre {
min-height:100px;
max-height:300px;
overflow-y: auto; /* 当内容高度超出元素高度时显示滚动条 */
overflow-x: auto; /* 隐藏水平滚动条 */
}
.entry-content pre:before {
content: '';
position: absolute;
top: 0;
left: 25px;
width: 15px;
height: 15px;
border-radius: 50%;
margin: 15px 25px;
background: #fdbc40;
}
ol.linenums:after {
content: '';
position: absolute;
top: 0;
left: 50px;
width: 15px;
height: 15px;
border-radius: 50%;
margin: 15px 25px;
background: #35cd4b;
}
/*代码高亮美化结束*/
😉 阿里云产品年付99元续费99元热卖,戳我领取!
THE END
暂无评论内容