Windows Live Writer Implementation code highlighting _ Web editor

Source: Internet
Author: User
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:
      1. Code concise, using <pre> tags to implement code highlighting, does not generate too many HTML tags.
      2. Supports multiple languages, including C#,c++,php,python and more than 10 languages.
      3. It is easy to expand and can support other languages through simple two development.
      4. 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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.