在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
为了实现代码高亮,之前找了很多插件,但是效果都不是很理想。经过研究终于找到一个完美的解决方案,这个解决方案具有如下优点:
下面一步步介绍如何配置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中可以十分优雅的显示出来。 |
请发表评论