- Download and unpack plugin files to wp-content/plugins/codecolorer directory.
- Enable "CodeColorer" plugin on your Plugins page in Site Admin.
- Go to the Options/CodeColorer page in Site Admin and change plugin's options as you wish.
- Use [cc lang="lang"]code[/cc] or <code lang="lang">code</cc> syntax to insert code snippet into the post (you could skip lang="lang", in this case code would be in codecolorer block, but without syntax highlighting).
- Have fun!
Syntax
To insert code snippet into your post (or comment) you should 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, number 1 or 0.
Possible parameters:
- lang (string) -- source language.
- tab_size (integer) -- how many spaces would represent TAB symbol.
- line_numbers (boolean) -- when true line numbers will be added.
- first_line (integer) -- a number of the first line in the block.
- no_links (boolean) -- when false keywords will be represented as links to manual.
- lines (integer) -- how many lines would be block height without scroll; could be set to -1 to remove vertical scrollbar.
- width (integer) -- block width.
- height (integer) -- height in pixels; used when lines number is greater then "lines" value.
- theme (string) -- color theme (default, blackboard, dawn, mac-classic, twitlight, vibrant).
- no_cc (boolean) -- when true the syntax in code block will not be highlighted, code will be rendered inside <code></code> tag.
All of these parameters could be configured via the CodeColorer options page.