代码高亮调整试验
历时两天,终于搞定了博客园的代码高亮了。
首先,请大家参考一下这篇文章的作法:博客园配置windows live writer,实现本地代码高亮
由于SyntaxHighlighter的版本更新了,所以文件的使用应该用新版本的SyntaxHighlighter
不过现在博客园的子标题不允许插入javascript代码了,所以我们把代码放进页首或者页尾html里面。(首先你需要申请博客的js权限)
1 |
会HTML的朋友应该知道{{your_blog_name}}是一个需要渲染的名字,所以{{your_blog_name}}要改成使用者博客的名字。
但是还有一个问题:博主在高亮完之后发现行列不对齐了!
查看了shCore.css文件发现 由于里面的这句话含有了!important属性 导致了部分代码的行高不正确
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | .syntaxhighlighter textarea { -moz-border-radius: 0 0 0 0 !important ; -webkit-border-radius: 0 0 0 0 !important ; background : none !important ; border : 0 !important ; bottom : auto !important ; float : none !important ; height : auto !important ; left : auto !important ; line-height : 1.1em !important ; /* Thsi line! */ margin : 0 !important ; outline : 0 !important ; overflow : visible !important ; padding : 0 !important ; position : static !important ; right : auto !important ; text-align : left !important ; top : auto !important ; vertical-align : baseline !important ; width : auto !important ; box-sizing: content-box !important ; font-family : "Consolas" , "Bitstream Vera Sans Mono" , "Courier New" , Courier , monospace !important ; font-weight : normal !important ; font-style : normal !important ; font-size : 1em !important ; min-height : inherit !important ; min-height : auto !important ; } |
所以只需要把shCore.css这一句话的!important属性去掉即可,更新文档即可。 (目前博主把文件面所有!important属性都去掉了,暂时没有发现问题。)
作者:
DingCao
Gtihub:
https://github.com/DingCao
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步