WordPress plugin--coolcode use method and download _javascript skills

Source: Internet
Author: User
Tags pear

This plugin was originally modified from chroder.com WordPress Code highlight Plug-ins. But the Coolcode plugin has modified a lot of content based on it.

    • Functional characteristics
    • How to use
    • Update history
    • Effect instance

Download: Coolcode

Improvements made by the Coolcode

    • Added the ability to download source code directly in file form.
    • Adds the option to display line numbering features, and you can hide or display line numbers by double-clicking the code in row number display mode.
    • Change the fixed-width code window to an adaptive window.
    • The style sheet has been redefined. Make the displayed code more beautiful.
    • Changed the code-highlighting class to the inline style. This is to facilitate the copying of color code into Rich-Text editors such as Word.
    • Modified the Html Renderer in the Text_highlighter. Fixed a problem where the original Html Renderer generated a highlight code that was copied out before each line of code before one more space.
    • Fixed write database error when the original plugin posting code contains \ '.
    • Fixed an error in the reply that could not be inserted into the code.
    • Defines the Coolcode label for XML and BBCode two syntaxes.
    • Added HTML language support.

There is no fixed problem.

    • Non-PHP code such as Html,javascript in PHP cannot be highlighted.
    • Scripts in HTML and XML cannot be highlighted in the appropriate script format.
    • Style sheets in HTML cannot be highlighted in a style table format.

These are the text_highlighter to solve, unless text_highlighter can solve these problems, these problems will remain.

How to use Coolcode

First, download and unzip to your WordPress plugin, and then activate the plugin in your WordPress.

I would like to add to the plug-in support for the WYSIWYG editor, and then tested that the WYSIWYG editor itself has too many problems, he can not correctly save the code to the database. Therefore, the functionality that is supported by WYSIWYG editor is currently canceled .

So if you want to use this plugin, please disable the WordPress "options"-> "writing"-> "automatic correction of incorrect inline XHTML syntax" and turn off the WYSIWYG editor in the options and the user, then use the following syntax.

Note: The current bracket syntax is equivalent to the angle bracket syntax, but it is not guaranteed to be equally effective later, and it is recommended to use the angle bracket syntax!

The syntax used is:


If you want to highlight a specific language, you can specify it by using the lang attribute:

<coolcode lang= "programming Language" >

If you do not need line numbers, you can use the LineNum property to specify:

<coolcode lang= "programming language" linenum= "off" >

If you want to be able to download code directly from a file, you can use the Download property to specify:

Download: Example.txt
<coolcode lang= "programming language" download= "filename. Extension" >

These three properties can be combined and do not affect each other.

The currently supported programming languages are:

    • ActionScript
    • Cpp
    • Css
    • Diff
    • Dtd
    • Html
    • Java
    • Javascript
    • Mysql
    • Perl
    • Php
    • Python
    • Ruby
    • Sql
    • Xml

Updated January 29, 2007

Fixed the export error caused by Coolcode on WordPress 2.1.

Updated May 25, 2006

Fixed bug that replaced \ ' ERROR with ' in code.

Updated March 4, 2006

Some of the WordPress options will cause "and: be modified so that the plugin does not work properly, the bug has now been fixed."

Updated February 28, 2006

Increased support for ActionScript language (from Zrong ' s Blog).

Updated the built in PEAR version.

Updated February 11, 2006

Fixed the problem that the Coolcode label cannot be nested.

Fixed the problem that the PHP program does not add <?php?> can not be highlighted.

Updated February 6, 2006

Fixed some topics that could not be displayed correctly because of the style sheet reason in row number display mode.

Fixed the last time because the fixed line at the beginning of a single space does not show the problem caused by some of the long text of IE can not wrap the new problem.

Removed files that are not required by the plugin in Text_highlighter.

Updated February 5, 2006

Fixed a problem where a single space at the beginning of the line does not appear.

Change the default display font on Windows to Fixedsys.

Update PEAR (including Xml_parser and Text_highlighter) to the latest version.

Updated January 26, 2006

Fixed the issue of using the page post 2 paging plugin to make the plug-in code download functional when the page was paged.

Updated January 20, 2006

Fixed the problem of using the page post 2 paging plugin to double-click the line number after the page turn to display the hidden function effect.

Updated January 11, 2006

Fixed the problem of not displaying code indentation correctly in non-highlight mode.

Fixed the problem of overlapping of line numbers over Firefox in non-highlighted line number mode.

Updated January 10, 2006

Fixed the problem of not displaying code indentation correctly in no Line mode.

Fixed the problem of displaying a no line font in number mode.

Updated January 4, 2006

Fixed a problem where you could not use the double-click Hidden line numbering feature for some topics without footer.php.

Updated December 29, 2005

Fixed a bug where double-clicking a hidden line number is invalid under some topics.

Fixed bugs that show inconsistent results under certain topics.

Updated with the built-in PEAR.

Updated December 20, 2005

The LineNum property is added, and you can choose whether to display line numbers.

Added the download attribute to download the code directly as a file.

Updated October 24, 2005

Modified the style sheet to make it appear more beautiful on Linux.

Updated July 20, 2005

Fixed a bug where some statements are too long to wrap.

Updated July 14, 2005

The XHTML checksum error was fixed.

Fixed a CSS checksum error.

Updated July 11, 2005

Fixed a bug that no longer appears on a blank line after the Firefox uplink is hidden.

Effect instance

Download: coolcode.js
  1. function linenumber(o) {
  2. if (o. ClassName = = "hl-main ln-hide") {
  3. o. Title = "Double Click to hide line number." ;
  4. o. ClassName = "hl-main ln-show";
  5. } else {
  6. o. Title = "Double Click to show line number." ;
  7. o. ClassName = "hl-main ln-hide";
  8. }
  9. }

Original works, reproduced please indicate the source.

Cloud Habitat Community Download address http://www.jb51.net/codes/9630.html

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.