- 授权协议: EPL
- 开发语言: JavaScript
- 操作系统: 跨平台
- 软件首页: https://github.com/chaopeng/chaoscodebox
- 软件文档: https://github.com/chaopeng/chaoscodebox
- 官方下载: https://github.com/chaopeng/chaoscodebox
软件介绍
什么是ChaosCodebox?
ChaosCodebox是一个网页的代码高亮库。它是使用google-code-prettify作为高亮引擎的。ChaosCodebox是一个ChaosBlog的一个子项目。
与google-code-prettify的区别
ChaosCodebox拥有一个复制到剪贴板的按钮,同时还会当前的显示语言类型。
怎样使用ChaosCodebox?
你需要在网页的<head>标签中插入如下的代码:
<link rel="stylesheet" type="text/css" href="http://cdn.staticfile.org/prettify/r298/prettify.css" />
<link rel="stylesheet" type="text/css" href="https://cdn.rawgit.com/chaopeng/chaoscodebox/v2.0/chaoscodebox-min/sons-of-obsidian.css" />
<link rel="stylesheet" type="text/css" href="https://cdn.rawgit.com/chaopeng/chaoscodebox/v2.0/chaoscodebox-min/chaoscodebox.css" />
<script type="text/javascript" src="http://cdn.staticfile.org/prettify/r298/prettify.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/1.5.0/clipboard.min.js"></script>
<script type="text/javascript" src="http://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript" src="https://cdn.rawgit.com/chaopeng/chaoscodebox/v2.0/chaoscodebox-min/chaoscodebox.js"></script>
<script type="text/javascript">
$(document).ready(function(){
prettify();
var clipboard = new Clipboard('.copy');
clipboard.on('success', function(e) {
e.clearSelection();
});
})
</script>
如果你有一些比较特殊的语言的话,你需要去google-code-prettify,增加一些css来增加这样语言的支持。同时你也可以通过修改css来修改配色主题。
我如何在wordpress中使用ChaosCodebox
- 将上述的代码添加到
wp-content/themes/[current_theme]/header.php - 在你的文章中使用
<pre><code class="language">code...</code></pre>来插入代码
如果你在使用ChaosCodebox有任何问题你可以联系我
weibo: http://weibo.com/chaojianpeng
更新日志
- v2.0
- 剪贴板实现由Flash迁移到clipboardjs
- 删除仓库中google-prettify的代码
感谢
黑客大曝光
Joel Scambray、Vincent Liu、Caleb Sima / 姚军 / 机械工业出版社华章公司 / 2011-10 / 65.00元
在网络技术和电子商务飞速发展的今天,Web应用安全面临着前所未有的挑战。所有安全技术人员有必要掌握当今黑客们的武器和思维过程,保护Web应用免遭恶意攻击。本书由美国公认的安全专家和精神领袖打造,对上一版做了完全的更新,覆盖新的网络渗透方法和对策,介绍如何增强验证和授权、弥补Firefox和IE中的漏洞、加强对注入攻击的防御以及加固Web 2.0安全,还介绍了如何将安全技术整合在Web开发以及更广泛......一起来看看 《黑客大曝光》 这本书的介绍吧!
