In order to achieve code highlighting, before looking for a lot of plug-ins, but the effect is not very ideal. After research has finally found a perfect solution, this solution has the following advantages:
- Code concise, using <pre> tags to implement code highlighting, does not generate too many HTML tags.
- Supports multiple languages, including C#,c++,php,python and more than 10 languages.
- It is easy to expand and can support other languages through simple two development.
- Easy to use, copy the code to the Code highlighting conversion window.
The following step-by-step article describes how to configure the Wlw+wordpress code highlighting solution:
1. Preparatory work:
Download precode Code Snippet Manager
A file named Precodeplugin_4.0.2.msi was obtained after the download was successful
Download SyntaxHighlighter2.0
After the download was successful, a file named Syntaxhighlighter_2.0.296.zip was obtained.
2. Installation:
Turn off Windows Live Writer and install Precodeplugin_4.0.2.msi. When the installation is successful, start WLW, in which case a plugin named Precode snippet should appear in the plugin list.
Unzip Syntaxhighlighter_2.0.296.zip to WordPress's active topic directory, such as: \www\wp\wp-content\themes\lutuzhi\syntaxhighlighter
3. In header.php, in <meta http-equiv= "Content-type" content= "<?php bloginfo" (' Html_type ')?>; charset=<?php bloginfo (' CharSet ');?> "/> Add:
Copy Code code as follows:
<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>
After this configuration, the code inserted through Windows Live Writer can be displayed gracefully in WordPress.