CodeColorer
Syntax highlighting for code snippets in posts, comments, and RSS, with inline code, themes, and line numbers.
Install in
CodeColorer lets you insert syntax-highlighted code snippets into posts, comments, and feeds.
CodeColorer currently bundles GeSHi 1.0.9.0 from the upstream 1.0.x line, with a small set of project-local maintenance patches for current PHP and WordPress compatibility.
Plugin based on GeSHi library, which supports most languages. CodeColorer has various nice features:
- syntax highlighting in RSS feeds
- syntax highlighting of a single line of code (inline)
- syntax highlighting of code in comments
- line numbers
- automatic links to the documentation inserting
- code block intelligent scroll detection (short code would have a short block, for a long one the block height would be fixed and a scrollbar would appear)
- predefined color themes (Slush & Poppies, Blackboard, Dawn, Mac Classic, Twitlight, Vibrant Ink, Railscasts, Solarized Light, Solarized Dark)
- syntax colors customization in CSS file
- code protect from mangling by WordPress (for example, quotes, double-dashes, and others would look just right as you entered)
Support
If you have any suggestions, found a bug, wanted to contribute a translation to your language, or just wanted to say “thank you”, feel free to email me kpumuk@kpumuk.info. I will try my best to answer you.
If you want to contribute your code, see the Development section under the Other Notes tab.
Supported languages
Here is the list of languages supported by CodeColorer: 4cs, 6502acme, 6502kickass, 6502tasm, 68000devpac, abap, actionscript, actionscript3, ada, aimms, algol68, apache, applescript, apt_sources, arm, asm, asp, asymptote, autoconf, autohotkey, autoit, avisynth, awk, bascomavr, bash, basic4gl, batch, bf, biblatex, bibtex, blitzbasic, bnf, boo, c, c_loadrunner, c_mac, c_winapi, caddcl, cadlisp, ceylon, cfdg, cfm, chaiscript, chapel, cil, clojure, cmake, cobol, coffeescript, cpp-qt, cpp-winapi, cpp, csharp, css, cuesheet, d, dart, dcl, dcpu16, dcs, delphi, diff, div, dos, dot, e, ecmascript, eiffel, email, epc, erlang, euphoria, ezt, f1, falcon, fo, fortran, freebasic, freeswitch, fsharp, gambas, gdb, genero, genie, gettext, glsl, gml, gnuplot, go, groovy, gwbasic, haskell, haxe, hicest, hq9plus, html4strict, icon, idl, ini, inno, intercal, io, ispfpanel, j, java, java5, javascript, jcl, jquery, julia, kixtart, klonec, klonecpp, kotlin, latex, lb, ldif, lisp, llvm, locobasic, logtalk, lolcode, lotusformulas, lotusscript, lscript, lsl2, lua, m68k, magiksf, make, mapbasic, mathematica, matlab, mercury, metapost, mirc, mk-61, mmix, modula2, modula3, mpasm, mxml, mysql, nagios, netrexx, newlisp, nginx, nimrod, nsis, oberon2, objc, objeck, ocaml-brief, ocaml, octave, oobas, oorexx, oracle11, oracle8, oxygene, oz, parasail, parigp, pascal, pcre, per, perl, perl6, pf, phix, php-brief, php, pic16, pike, pixelbender, pli, plsql, postgresql, postscript, povray, powerbuilder, powershell, proftpd, progress, prolog, properties, providex, purebasic, pycon, pys60, python, q, qbasic, qml, racket, rails, rbs, rebol, reg, rexx, robots, rpmspec, rsplus, ruby, rust, sas, sass, scala, scheme, scilab, scl, sdlbasic, smalltalk, smarty, spark, sparql, sql, standardml, stonescript, swift, systemverilog, tcl, tclegg, teraterm, texgraph, text, thinbasic, tsql, twig, typoscript, unicon, upc, urbi, uscript, vala, vb, vbnet, vbscript, vedit, verilog, vhdl, vim, visualfoxpro, visualprolog, whitespace, whois, winbatch, xbasic, xml, xojo, xorg_conf, xpp, xyscript, yaml, z80, zxbasic.
Development
Sources of this plugin are available both in SVN and Git:
The GitHub repository includes local contributor tooling based on mise, Composer, pnpm, and wp-env. A typical setup is:
mise installmise run bootstrapmise run testmise run wp-start
Feel free to check them out, make your changes and send me patches or pull requests. Promise, I will apply every patch (of course, if they add a value to the product). Email for patches, suggestions, or bug reports: kpumuk@kpumuk.info.
If you’re interested in translating CodeColorer to your language, please check out the translation page for the plugin.
Customization
Syntax coloring is highly customizable: you could change the color scheme for all languages or a specific language. You could find CodeColorer CSS in wp-content/plugins/codecolorer/codecolorer.css file. To change colors for all languages edit lines below Color scheme section.
There is a simple mapping between TextMate color themes and CodeColorer ones:
/* "Slush & Poppies" color scheme (default) */
.codecolorer-container, .codecolorer { color: #000000; background-color: #F1F1F1; }
/* Comment */
.codecolorer .co0, .codecolorer .co1, .codecolorer .co2, .codecolorer .co3, .codecolorer .co4, .codecolorer .coMULTI { color: #406040; font-style: italic; }
/* Constant */
.codecolorer .nu0, .codecolorer .re3 { color: #0080A0; }
/* String */
.codecolorer .st0, .codecolorer .st_h, .codecolorer .es0, .codecolorer .es1 { color: #C03030; }
/* Entity */
.codecolorer .me1, .codecolorer .me2 { color: #0080FF; }
/* Keyword */
.codecolorer .kw1, .codecolorer .kw2, .codecolorer .sy1 { color: #2060A0; }
/* Storage */
.codecolorer .kw3, .codecolorer .kw4, .codecolorer .kw5, .codecolorer .re2 { color: #008080; }
/* Variable */
.codecolorer .re0, .codecolorer .re1 { color: #A08000; }
/* Global color */
.codecolorer .br0, .codecolorer .sy0 { color: #000000; }
Check the codecolorer.css file to get more examples.
Written by Joobi from the project's own listing. See the source page
0.12.1 (November 24, 2026)
- Improved filtering of HTML in comments.
- Added the
codecolorer_comment_allowed_htmlfilter to customize the HTML allowed in comments.
0.12.0 (August 14, 2026)
- Added a WordPress Playground demo with sample highlighted content.
- Added dedicated publishing for WordPress.org plugin-directory assets.
- Expanded real WordPress compatibility coverage through WordPress 7.1 and refreshed development tooling.
0.11.0 (March 13, 2026)
- Fixed comment protection for suffixed shortcodes such as
[cc_php]and[cci_php]. - Modernized admin asset loading and hardening around settings sanitization, nonce-protected dismissals, and direct-access guards.
- Improved documentation and release metadata, including clearer usage docs and safer WordPress.org asset publishing.
0.10.2 (March 12, 2026)
- Fixed stored XSS in shortcode attributes, including comment-rendered shortcodes.
- Improved compatibility coverage across supported PHP and WordPress versions with real WordPress integration tests.
- Modernized local development, CI, and release tooling for more reliable maintenance.
0.10.1 (May 28, 2023)
- Addressed a script injection in custom CSS classes and custom CSS block.
0.10.0 (April 28, 2023)
- Addressed compatibility issues with PHP 8.0+ and tested with the latest WordPress version.
0.9.16 (July 23, 2018)
- Fixed a bug when iOS would adjust the text size for line numbers and code differently, leading to non-consistent line numeration.
- Added scrollbars on Webkit (especially important for iOS).
- CodeColorer block width can be number, percent, or em.
- Added integration with Simple Download Monitor.
0.9.15 (February 24, 2017)
- IMPORTANT: Fixed a bug with CodeColorer breaking admin pages without editor.
0.9.14 (October 25, 2017)
- IMPORTANT: Another line numbers column width issue for numbers bigger than 1000.
0.9.13 (October 24, 2017)
- IMPORTANT: Fixed line numbers column width issue, introduces in the previous version.
- Fixed line numbers column position on RTL pages.
0.9.12 (October 12, 2017)
- Fixed XML syntax highlighting colors.
- Fixed line highlighting color for dark themes.
- Added support for TablePress plugin.
- Line highlighting affects the whole block width, not only the code text.
0.9.11 (August 8, 2017)
- Fixed an issue with TinyMCE when CodeColorer options were removed in the editor (thanks to Jonathan Stassen for the suggestion).
- New art for the WordPress plugins page.
- Moved translations to https://translate.wordpress.org/projects/wp-plugins/codecolorer. WordPress should automatically download language packs now.
- Lots of code style issues, should resolve all warnings in PHP logs.
0.9.10 (July 28, 2017)
- Fixed a bug with large code blocks margins.
- Added Portuguese translation (thanks to Luis Coutinho).
- Added Indonesian translation (thanks to Masino Sinaga).
- Fixed PHP 7 compatibility issues (thanks to Steve Kamerman and Robert Felty).
- Fixed WordPress 4+ compatibility (editor button, settings page layout).
- Added “Solarized Light” and “Solarized Dark” themes (thanks to Matt Kirman).
You can find complete changelog on the CodeColorer history page.
Follow this listing's changes (Atom feed)