在twitter bootstrap上突出显示语法

Gan*_*alf 16 prettify twitter-bootstrap

我试图突出一些使用谷歌美化的语法,但到目前为止,它不起作用.

<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">
  <code class="language-css">
  // Some source code

    class Foo {
      public int Bar { get; set; }
    }
  </code>
</pre>
Run Code Online (Sandbox Code Playgroud)

是否有一个解决方案,使这项工作不会过多地使用bootstrap中的pre标签?

bap*_*tme 25

编辑:对于twitter bootstrap 2.0.x,它适用于2.1.x

使用这两个文件而不是使用doc中描述的方法.

http://twitter.github.com/bootstrap/assets/js/google-code-prettify/prettify.css

http://twitter.github.com/bootstrap/assets/js/google-code-prettify/prettify.js

这适合我

<!DOCTYPE html>
<html lang="en">
<head>
<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>
</head>
<body onload="prettyPrint()" bgcolor="white">
<pre class="prettyprint linenums languague-css">
// Some source code
class Foo {
    public int Bar { get; set; }
}
</pre>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)