CodeColorer is a syntax highlighting plugin which allows inserting code snippets into blog posts. The plugin supports color themes, code samples in RS …
CodeColorer is the plugin which allows you to insert code snippets into the post with nice syntax highlighting.
Plugin based on GeSHi library, which supports most languages. CodeColorer has various nice features:
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 [email protected]. Promise, I will answer every email I received.
If you want to contribute your code, see the Development section under the Other Notes tab.
Here is list of supported by CodeColorer languages: 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, html5, icon, idl, ini, inno, intercal, io, ispfpanel, j, java, java5, javascript, jcl, jquery, julia, 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.
Sources of this plugin are available both in SVN and Git:
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: [email protected].
If you’re interested in translating CodeColorer to your language, please check out the translation page for the plugin.
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 simple mapping exists 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.
[cc lang="lang"]code[/cc]
or <code lang="lang">code</cc>
syntax to insert a code snippet into the post (you could skip lang="lang"
, in this case code would be in CodeColorer’s code block, but without syntax highlighting). Also you can use [cci lang="lang"]code[/cci]
to format inline code (see the “inline” option description).To insert a code snippet into your post (or comment) you would use [cc lang="lang"]code[/cc]
or <code lang="lang">code</cc>
syntax. Starting from version 0.6.0 you could specify additional CodeColorer options inside [cc]
tag:
[cc lang="php" tab_size="2" lines="40"] // some code [/cc]
Note: You should always use double quotes or single quotes around the parameter value. Boolean values could be passed using string true or false, on or off, number 1 or 0.
Starting from CodeColorer 0.8.6 you can use short codes to insert code snippets. The short code in common looks like [ccM_LANG]
, where LANG is your programming language, and M is the one or more of following modes:
Small letter means enabled, capital – disabled. Examples:
PHP code with links enabled and line numbers disabled:
[cclN_php] echo "hello" [/cclN_php]
Already escaped HTML code:
[ccie_html]<html>[/ccie_html]
Ruby code without wrapping having tab size equal to 4:
[ccW_ruby tab_size="4"] attr_accessor :title [/ccW_ruby]
More examples could be found on the CodeColorer Examples page. You can find modes explained below.
1,5,8-11
).<
or [
will be treated as encoded (in this example as <
and [
respectively.)`` tag.
You can use special tag [cci]
instead of [cc]
to force inline mode:
[cci lang="php"]some code[/cci]
Most of these parameters could be configured via the CodeColorer options page.
To insert example of CodeColorer short codes you can use something like this:
[cce_bash] &#91;cc lang="html"] <title>CodeColorer short code colorized</title> &#91;/cc] [/cce_bash]
Go to the Options/CodeColorer page in Site Admin and change the “Custom CSS Styles” option.
You should use [cc escaped="true"]
or [cce]
in the visual editor when inserting code into the post.
CodeColorer performs code highlighting on the server; you could see HTML of the highlighted code in the page source.
Yes, resulting XHTML is completely valid.
Yes, CodeColorer supports code highlighting in comments using the same syntax, as you use in your blog posts.
` block?
Use <code no_cc="true">
option for your code block.
Warning: array_keys() [function.array-keys]: The first argument should be an array in /home/wordpress/wp-content/plugins/codecolorer/lib/geshi.php on line 3599
Remove all files from the wp-content/plugins/codecolorer folder and unpack an archive with plugin again (thanks to Anatoliy ‘TLK’ Kolesnick).
You can upload this file using WordPress upload or put it somewhere in uploads folder, and the specify relative path using file="relative/path/to/file"
attribute:
[cc_ruby file="test_project/main.rb"][/cc_ruby]
This snippet will insert code from the UPLOADS_DIR/test_project/main.rb file.
The solution is to add notranslate
class to the list of “Custom CSS Classes” on the admin plugin settings page.
Yes. We do not store or process any user information.
You can find complete changelog on the CodeColorer history page.