五、Google Code Prettify:实现代码高亮的JS库

时间:2014-03-03 15:54:07   收藏:0   阅读:575

介绍

bubuko.com,布布扣

开始使用

 <link rel="stylesheet" href="css/prettify.css" /> <!-- 设置代码主题,此文件为默认主题,你可以换成其他主题-->
<script src="js/prettify.js" type="text/javascript"></script>
<body onload="prettyPrint()">

例子

代码主题选择

 bubuko.com,布布扣

 

默认在prettify中有5种选择:

比如你想使用sunburst.css,则我们只需要将:

<link rel="stylesheet" href="css/prettify.css" />

替换成

<link rel="stylesheet" href="css/sunburst.css" />

扩展样式可以从 http://jmblog.github.io/color-themes-for-google-code-prettify/ 下载。

语言支持

参考文献

[1] 官方文档:http://google-code-prettify.googlecode.com/svn/trunk/README.html

[2] 扩展的Prettify主题CSS样式:http://jmblog.github.io/color-themes-for-google-code-prettify/

[3] 代码格式化工具:http://tool.oschina.net/codeformat

五、Google Code Prettify:实现代码高亮的JS库,布布扣,bubuko.com

原文:http://www.cnblogs.com/xiazdong/p/3575693.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!