cnblogs的代码高亮

mac2022-06-30  112

由于不喜欢cnblogs原来的代码高亮方案,于是自己瞎搞,外加看这位大神的blog以及BZOJ的代码高亮,终于是搞出来了。。。讲讲怎么弄吧。

当然对于了解css的大神可以无视以下文字……

其实就是登上SyntaxHighlighter的官网,点一下右边的download和installation,然后照着做,把shCore.js和shCoreDefault.css和shBrush*****.js传上去,然后改一下页首和页脚html代码就可以了。比如我的页首html代码:

<!-- Include required JS files --> <script type="text/javascript" src="http://files.cnblogs.com/lazycal/shCore.js"></script> <!-- At least one brush, here we choose JS. You need to include a brush for every language you want to highlight --> <script type="text/javascript" src="http://files.cnblogs.com/lazycal/shBrushCpp.js"></script> <script type="text/javascript" src="http://files.cnblogs.com/lazycal/shBrushXml.js"></script> <!-- Include *at least* the core style and default theme --> <link href="http://files.cnblogs.com/lazycal/shCoreDefault.css" rel="stylesheet" type="text/css" />

  

页脚html代码

<script type="text/javascript"> SyntaxHighlighter.all() </script>

另附去除右侧滚动条的方法:点这里

转载于:https://www.cnblogs.com/lazycal/p/3254634.html

相关资源:JAVA上百实例源码以及开源项目
最新回复(0)