CodeColorer Examples

Posted by Dmytro Shteflyuk on

All features

Here is a long list of examples of CodeColorer in action:

Block width (px)
Block width (%)
1
2
3
  [cc lang="bash" escaped="true" width="370"]
    # Block width in pixels
  [/cc]
1
2
3
  [cc lang="bash" escaped="true" width="90%"]
    # Block width in percents
  [/cc]
1
2
3
  [ccie_bash width="370"]
    # Block width in pixels
  [/cce_bash]
1
2
3
  [cce_bash width="90%"]
    # Block width in percents
  [/cce_bash]
 
Block height and many lines Block height and a few lines
1
2
3
4
5
  [cc lang="bash" escaped="true" width="370" height="70" lines="3"]
    # Block height and many lines
    # Block height and many lines
    # Block height and many lines
  [/cc]
1
2
3
4
5
  [cc lang="bash" escaped="true" width="370" height="70" lines="5"]
    # Block height and a few lines
    # Block height and a few lines
    # Block height and a few lines
  [/cc]
1
2
3
4
5
  [cce_bash width="370" height="70" lines="3"]
    # Block height and many lines
    # Block height and many lines
    # Block height and many lines
  [/cce_bash]
1
2
3
4
5
  [cce_bash width="370" height="70" lines="5"]
    # Block height and a few lines
    # Block height and a few lines
    # Block height and a few lines
  [/cce_bash]
 
Tab size with tabs Tab size with spaces
1
2
3
    [cc lang="bash" escaped="true" width="370" tab_size="4"]
        # Tab size with tabs
    [/cc]
1
2
3
  [cc lang="bash" escaped="true" width="370" tab_size="4"]
    # Tab size with spaces
  [/cc]
1
2
3
    [cce_bash width="370" tab_size="4"]
        # Tab size with tabs
    [/cce_bash]
1
2
3
  [cce_bash width="370" tab_size="4"]
    # Tab size with spaces
  [/cce_bash]
 
With line numbers Without line numbers
1
2
3
  [cc lang="bash" escaped="true" width="370" line_numbers="on"]
    # With line numbers
  [/cc]
  [cc lang="bash" escaped="true" width="370" line_numbers="off"]
    # Without line numbers
  [/cc]
1
2
3
  [ccen_bash width="370"]
    # With line numbers
  [/ccen_bash]
  [cceN_bash width="370"]
    # Without line numbers
  [/cceN_bash]
 
With first line and line numbers With invalid first line
20
21
22
  [cc lang="bash" escaped="true" width="370" first_line="20" line_numbers="on"]
    # With first line and line numbers
  [/cc]
1
2
3
  [cc lang="bash" escaped="true" width="370" first_line="-1" line_numbers="on"]
    # With invalid first line
  [/cc]
20
21
22
  [ccel_bash width="370" first_line="20"]
    # With first line and line numbers
  [/ccel_bash]
1
2
3
  [ccel_bash width="370" first_line="-1"]
    # With invalid first line
  [/ccel_bash]
 
Default theme Blackboard theme
1
2
3
  [cc lang="bash" escaped="true" width="370" theme="default"]
    # Default theme
  [/cc]
1
2
3
  [cc lang="bash" escaped="true" width="370" theme="blackboard"]
    # Blackboard theme
  [/cc]
1
2
3
  [cce_bash width="370" theme="default"]
    # Default theme
  [/cce_bash]
1
2
3
  [cce_bash width="370" theme="blackboard"]
    # Blackboard theme
  [/cce_bash]
 
Wrap long lines Disable border
  [cc lang="bash" escaped="true" width="370" nowrap="0" line_numbers="0"]
    # Wrap long lines
  [/cc]
1
2
3
  [cc lang="bash" escaped="true" width="370" noborder="1"]
    # Disable border
  [/cc]
  [cceWN_bash width="370"]
    # Wrap long long long long lines
  [/cceWN_bash]
1
2
3
  [cceb_bash width="370"]
    # Disable border
  [/cceb_bash]
 
Disabled highlighting (no_cc) Disabled highlighting (enabled)
[cc lang="bash" escaped="true" width="370" no_cc="true"] # Disabled highlighting (no_cc) [/cc]
[cc lang="bash" escaped="true" enabled="false"] # Disabled highlighting (enabled) [/cc]
[cce_bash width="370" no_cc="true"] # Disabled highlighting (no_cc) [/cce_bash]
[cce_bash enabled="false"] # Disabled highlighting (enabled) [/cce_bash]

Should save spaces around code block in inline mode

It should work for both for [cc] and <code> (before and after). When there are no spaces it should not add by itself ([cc]) and (<code>).

Should use theme of the code block in inline mode

It should work for both for [cc] and <code>.

Should support GeSHi theme

It should work for both for inline render :partial => 'form', :locals => { :model => @model } and block:

1
2
@model = Model.find(:first)
render :partial => 'form', :locals => { :model => @model }

CodeColorer — the best syntax highlighting plugin for WordPress

Back to CodeColorer home page.