来源:自学PHP网 时间:2014-12-14 21:28 作者: 阅读:次
[导读] 有时会包含大量代码,如果能在文章中高亮显示代码文章的可读性肯定会好很多。...
为了实现代码高亮,之前找了很多插件,但是效果都不是很理想。经过研究终于找到一个完美的解决方案,这个解决方案具有如下优点:
下面一步步介绍如何配置WLW+wordpress的代码高亮解决方案: 1.准备工作:
2.安装: 关闭Windows Live Writer,安装PreCodePlugin_4.0.2.msi。安装成功后启动WLW,此时在插件列表里应该出现一项名为PreCode Snippet的插件。 将syntaxhighlighter_2.0.296.zip解压缩至wordpress的活动主题目录,例如:\www\wp\wp-content\themes\lutuzhi\syntaxhighlighter 3.在header.php 中,在<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />下方添加: 复制代码 代码如下: <script type="text/javascript" src="scripts/shCore.js"></script> 02.<script type="text/javascript" src="scripts/shBrushBash.js"></script> 03.<script type="text/javascript" src="scripts/shBrushCpp.js"></script> 04.<script type="text/javascript" src="scripts/shBrushCSharp.js"></script> 05.<script type="text/javascript" src="scripts/shBrushCss.js"></script> 06.<script type="text/javascript" src="scripts/shBrushDelphi.js"></script> 07.<script type="text/javascript" src="scripts/shBrushDiff.js"></script> 08.<script type="text/javascript" src="scripts/shBrushGroovy.js"></script> 09.<script type="text/javascript" src="scripts/shBrushJava.js"></script> 10.<script type="text/javascript" src="scripts/shBrushJScript.js"></script> 11.<script type="text/javascript" src="scripts/shBrushPhp.js"></script> 12.<script type="text/javascript" src="scripts/shBrushPlain.js"></script> 13.<script type="text/javascript" src="scripts/shBrushPython.js"></script> 14.<script type="text/javascript" src="scripts/shBrushRuby.js"></script> 15.<script type="text/javascript" src="scripts/shBrushScala.js"></script> 16.<script type="text/javascript" src="scripts/shBrushSql.js"></script> 17.<script type="text/javascript" src="scripts/shBrushVb.js"></script> 18.<script type="text/javascript" src="scripts/shBrushXml.js"></script> 19.<link href="styles/shCore.css" type="text/css" rel="stylesheet" /> 20.<link href="styles/shThemeEmacs.css" type="text/css" rel="stylesheet" /> 21.<script type="text/javascript">SyntaxHighlighter.config.clipboardSwf = 'scripts/clipboard.swf';SyntaxHighlighter.all();</script> 如此配置之后,通过Windows Live Writer插入的代码,在wordpress中可以十分优雅的显示出来。 |
自学PHP网专注网站建设学习,PHP程序学习,平面设计学习,以及操作系统学习
京ICP备14009008号-1@版权所有www.zixuephp.com
网站声明:本站所有视频,教程都由网友上传,站长收集和分享给大家学习使用,如由牵扯版权问题请联系站长邮箱904561283@qq.com