|
|
WordPress:CodeHighlighterPlugin
From IdeA thinKING
Overview
This plugin is a syntax highlighter for source code. It uses GeSHi as fontifier engine.
Requirements
- Wordpress 2.x.
- Compatible with all web servers including Apache and IIS.
Download
Installation
To install the plugin:
- Unzip the plugin archive.
- Upload the directory to the /wp-content/plugins/ directory
- Activate the plugin through the 'Plugins' menu in WordPress
Usage
- Put the code snippet to pre tag.
- Add the lang attribute to the pre tag like the following.
- Add the lineno attribute to the pre tag after the lang tag like the following if you want to display line numbers. The number in the lineno tag becomes a start line number. There is no default value for the start line number. So you must supply the value to the lineno tag.
- <pre lang="cpp" lineno="1">
- If you do not add lang attribute, the pre tag is handled normally.
- If you want to have border, add the style like the following to your .css file.
- pre { border: 1px dotted #ccc; padding: 0.2em 0.5em; }
- You can use following languages in lang.
- abap, actionscript, ada, apache, applescript, asm, asp, autoit, bash, blitzbasic, bnf, c, c_mac, caddcl, cadlisp, cfdg, cfm, cpp-qt, cpp, csharp, css-gen, css, d, delphi, diff, div, dos, dot, eiffel, fortran, freebasic, genero, gml, groovy, haskell, html4strict, idl, ini, inno, io, java, java5, javascript, latex, lisp, lua, m68k, matlab, mirc, mpasm, mysql, nsis, objc, ocaml-brief, ocaml, oobas, oracle8, pascal, per, perl, php-brief, php, plsql, python, qbasic, rails, reg, robots, ruby, sas, scheme, sdlbasic, smalltalk, smarty, sql, tcl, text, thinbasic, tsql, vb, vbnet, vhdl, visualfoxpro, winbatch, xml, xpp, z80
Screenshots
Known issues
- Because this plugin uses regular expression to match string range from '<pre lang="some">' to '</pre>', you can't use '</pre>' in your code snippet. If you must put the '</pre>' tag, you can put a space between '<' and '/pre> like '< /pre>'. The '< /pre>' is converted to '</pre>' automatically by plugin.
- If you want to change the style, you should modify the plugin source file. (codehighlighter.php)
Contact
You can leave a comment at CodeHighlighter plugin test page
.
License
Copyright (C) 2008 Wongoo Lee
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
Version history
- 1.8 Mar 9 2008
- Upgrade GeSHi version to 1.0.7.20.
- 1.7 Mar 17 2007
- Remove two WP filters; wptexturize and convert_chars. This helps making code concise.
- 1.6 Mar 7 2007
- Fix a bug that plus signs are not shown.
- 1.5 Mar 5 2007
- Add an option to display line numbers with 'lineno="startline"'.
- Handle'</pre>' tag in the code snippet with '< /pre>'.
- 1.4 Mar 1 2007
- Polish the regular expression of plugin to support html better.
- 1.3 Feb 8 2007
- Handle WP's character conversion before highlighting.
- Upgrade GeSHi to 1.0.7.17.
- 1.2 Jan 5 2007
- Drop the 'em' feature.
- Upgrade GeSHi to 1.0.7.16.
- 1.0 May 24 2006
Reference
iwongu 15:15, 5 January 2007 (KST)
|