bootstrap设计站点中加入�代码高亮插件
2014-06-10 14:51
232 查看
这款插件的名字叫做google-code-prettify
使用该插件之前的效果:
![](http://img.blog.csdn.net/20140523004325968?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvcXN5emI=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)
使用插件之后的效果:
![](http://img.blog.csdn.net/20140523004433562?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvcXN5emI=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)
接下来说步骤:
(1)下载两个文件
http://codecloud.sinaapp.com/google-code-prettify/prettify.css http://codecloud.sinaapp.com/google-code-prettify/prettify.js
(2)在head中引入这两个文件
(3)在body加上onload=”prettyPrint()
(4)把代码放进
Lang-html”,在lang- 后加入�下面不论什么一种语言。“bash”, “c”, “cc”, “cpp”, “cs”, “csh”, “cyc”, “cv”, “htm”, “html”, ”java”, “js”, “m”, “mxml”, “perl”, “pl”, “pm”, “py”, “rb”, “sh”, ”xhtml”, “xml”, “xsl”
(5)打开行号
你能够使用linenums打开行号
使用该插件之前的效果:
使用插件之后的效果:
接下来说步骤:
(1)下载两个文件
http://codecloud.sinaapp.com/google-code-prettify/prettify.css http://codecloud.sinaapp.com/google-code-prettify/prettify.js
(2)在head中引入这两个文件
<link href="google-code-prettify/prettify.css" type="text/css" rel="stylesheet" /> <script type="text/javascript" src="google-code-prettify/prettify.js"></script>
(3)在body加上onload=”prettyPrint()
<body onload="prettyPrint()">...</body>
(4)把代码放进
<pre>...</pre>或者
<code>...</code>就能够实行代码高亮了。你也能够指定一种语言,class=”prettyprint
Lang-html”,在lang- 后加入�下面不论什么一种语言。“bash”, “c”, “cc”, “cpp”, “cs”, “csh”, “cyc”, “cv”, “htm”, “html”, ”java”, “js”, “m”, “mxml”, “perl”, “pl”, “pm”, “py”, “rb”, “sh”, ”xhtml”, “xml”, “xsl”
(5)打开行号
你能够使用linenums打开行号
<pre class=”prettyprint linenums Lang-html”>
相关文章推荐
- bootstrap设计站点中加入代码高亮插件
- bootstrap设计网站中添加代码高亮插件
- bootstrap设计网站中添加代码高亮插件
- CKEditor中加入代码高亮插件syntaxhighlighter
- CKEditor中加入代码高亮插件syntaxhighlighter
- CKEditor中加入syntaxhighlighter代码高亮插件
- jQuery.Syntax-我blog用的代码高亮插件
- 使用 Windows Live Writer 代码高亮插件
- FCKeditor 和 SyntaxHighlighter 代码高亮插件的整合
- asp.net 为FCKeditor开发代码高亮插件实现代码
- wordpress可视化设计器下插入高亮代码方法
- 解决了Live Writer 代码高亮插件【Paste from Visual Studio】的两个BUG
- Live Write 的代码高亮插件 Paste Code
- 介绍一种方法,无需插件支持blog代码高亮,代码发芽网
- 代码高亮插件 c#(asp.net)
- 代码高亮插件SyntaxHighlighter
- Eclipse增加JavaScript插件_高亮显示_代码补全
- Windows Live Writer 代码高亮语法插件中文版
- Discuz5.5.0代码高亮显示+运行代码框合成插件 下载第1/4页
- 代码发芽网:无需插件支持Blog代码高亮,支持近百种编程语言