twitter bootstrap 上的语法高亮 [英] Syntax highlighting on twitter bootstrap
问题描述
我正在尝试使用 Google prettify 突出显示一些语法,但到目前为止,它不起作用.
<script type="text/javascript" src="prettify.js"></script><body onload="prettyPrint()" bgcolor="white"><pre class="prettyprint"><code class="language-css">//一些源代码类 Foo {公共 int 栏 { 得到;放;}}
有没有一种解决方案可以使这项工作正常工作,而不会过多地弄乱引导程序中已有的 pre 标签?.
对于 twitter bootstrap 2.0.x,它在 2.1.x 上运行良好
使用这两个文件而不是使用文档中描述的方法.
http://twitter.github.com/bootstrap/assets/js/google-code-prettify/prettify.css
http://twitter.github.com/bootstrap/assets/js/google-code-prettify/prettify.js
这对我有用
<html lang="zh-cn"><头><link href="css/bootstrap.css" type="text/css" rel="stylesheet"/><link href="prettify.css" type="text/css" rel="stylesheet"/><script type="text/javascript" src="prettify.js"></script>头部><body onload="prettyPrint()" bgcolor="white"><pre class="prettyprint linenums languague-css">//一些源代码类 Foo {公共 int 栏 { 得到;放;}}