CodeColorer

· Русский (74,494 views)

CodeColorer is the plugin which allows you to insert code snippets into the post with nice syntax highlighting. I want to show you example first:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
class Feed < ActiveRecord::Base

  SourceTypes = {
    :category => 0,
    :tag => 1
  }
 
  define_enum :source_type, :raise_on_invalid => true

  #-------------------------------------------------
  # Accessors

  def video_ids
    v = self[:video_ids]
    v ? v.split(':').map(&:to_i) : []
  end
end

Plugin based on GeSHi library, which supports most languages. CodeColorer has various nice features:

  • syntax highlighting in RSS feeds
  • syntax highlighting of 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 short block, for long one block height would be fixed and scrollbar would appear)
  • predefined color themes (Slush & Poppies, Blackboard, Dawn, Mac Classic, Twitlight, Vibrant Ink)
  • syntax colors customization in CSS file
  • code protect from mangling by Wordpress (for example, quotes, double-dashes, etc would look just right as you entered)

Installation

  1. Download and unpack plugin files to wp-content/plugins/codecolorer directory.

  2. Enable CodeColorer plugin on your Plugins page in Site Admin.

  3. Go to the Options/CodeColorer page in Site Admin and change plugin’s options as you wish.

  4. Use [cc lang="lang"]code[/cc] or <code lang="lang">code</code> syntax to insert code snippet into the post (you could skip lang="lang", in this case code would be in code block, but without syntax highlighting). Also you can use [cci lang="lang"]code[/cci] to format inline code (see the “inline” option description). The list of available languages you could find below.

  5. 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</code> syntax. Starting from version 0.6.0 you could specify additional CodeColorer options inside [cc] tag:

1
[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.

Short codes

Starting from CodeColorer 0.8.6 you can use short codes to insert code snippets. The short code in common looks like [ccMODE_LANG], where LANG is your programming language, and MODE is the one or more of following modes:

  • iinline
  • eescaped
  • sstrict
  • nline_numbers
  • bno_border
  • wno_wrap
  • lno_links

Small letter means enabled, capital – disabled. Examples:

PHP code with links enabled and line numbers disabled:

1
2
3
[cclN_php]
echo "hello"
[/cclN_php]

Already escaped HTML code:

1
[ccie_html]<html>[/ccie_html]

Ruby code without wrapping having tab size equal to 4:

1
2
3
[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.

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 or string) – block width.
  • height (integer or string) – height in pixels; used when lines number is greater then “lines” value.
  • rss_width (integer or string) – block width in RSS feeds.
  • theme (string) – color theme (default, blackboard, dawn, mac-classic, twitlight, vibrant).
  • inline (boolean) – when true forces code block to render inside <code></code> tag. Used to paste a single line of code into the regular text.
  • strict (boolean) – when true strict mode will be enabled. By default CodeColorer tries to guess whether strict mode is needed, so this option allows to force it on or off when automatic suggestion is wrong.
  • nowrap (boolean) – when false no horizontal scrollbar will be shown; instead code will be wrapped in the end of code box.
  • noborder (boolean) – when true no border will be shown around the code block.
  • no_cc (boolean) – when true the syntax in code block will not be highlighted, code will be rendered inside <code></code> tag.
  • class (string) – additional CSS classes to add to the wrapper HTML element.

You can use special tag [cci] instead of [cc] to force inline mode: [cci lang="lang"]code[/cci]

Most of these parameters could be configured via the CodeColorer options page.

Supported languages

Here is list of supported by CodeColorer languages: abap, actionscript, actionscript3, ada, apache, applescript, apt_sources, asm, asp, autoit, avisynth, bash, basic4gl, bf, bibtex, blitzbasic, bnf, boo, c, c_mac, caddcl, cadlisp, cfdg, cfm, cil, cmake, cobol, cpp-qt, cpp, csharp, css, d, dcs, delphi, diff, div, dos, dot, eiffel, email, erlang, fo, fortran, freebasic, genero, gettext, glsl, gml, gnuplot, groovy, haskell, hq9plus, html4strict, idl, ini, inno, intercal, io, java, java5, javascript, kixtart, klonec, klonecpp, latex, lisp, locobasic, lolcode, lotusformulas, lotusscript, lscript, lsl2, lua, m68k, make, matlab, mirc, modula3, mpasm, mxml, mysql, nsis, oberon2, objc, ocaml-brief, ocaml, oobas, oracle11, oracle8, pascal, per, perl, php-brief, php, pic16, pixelbender, plsql, povray, powershell, progress, prolog, properties, providex, python, qbasic, rails, rebol, reg, robots, ruby, sas, scala, scheme, scilab, sdlbasic, smalltalk, smarty, sql, tcl, teraterm, text, thinbasic, tsql, typoscript, vb, vbnet, verilog, vhdl, vim, visualfoxpro, visualprolog, whitespace, whois, winbatch, xml, xorg_conf, xpp, yaml, z80.

Requirements

Plugin works with Wordpress 2.7.0 – 2.8.2 as well. Hey users of WordPress 2.7.0, could you explain why do you use so old buggy crap? Use new one instead, at least it looks more beautiful!

Download

The latest version of the CodeColorer plugin is 0.9.7, and you can download it here:

version0.9.7DownloadCodeColorer Plugin

Also you can download older versions from plugin home page on WordPress.org (but do you really need this old stuff?).

Translations

Thank you all guys, who submitted translations to your language. CodeColorer is currently available in following languages:

Want to help me with translation? It’s easy!

  1. Install Poedit.

  2. Download codecolorer.pot file.

  3. Click File/New catalog from .pot file and select codecolorer.pop you’ve just downloaded.

  4. Enter project name (something like CodeColorer 0.9.1), your name and email address, select a language you want to translate to and click OK.

  5. Enter a filename like codecolorer-en_EN.po and click Save.

  6. Translate all strings one by one.

  7. Send me a .po file with a translation to kpumuk@kpumuk.info. Do not forget a link to add to CodeColorer project home page.

  8. Thank you!

To fix existing translation, just open corresponding .po file from codecolorer/languages folder in Poedit, and add missing or update existing strings.

Customization

Syntax coloring is highly customizable: you could change color scheme for all
languages or for 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:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
    /* "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.

Frequently Asked Questions

Q. How do I can customize CodeColorer CSS rules?
A. Go to the Options/CodeColorer page in Site Admin and change the “Custom CSS Styles” option.

Q. I see &lt; instead of < (or other HTML entities like >, &, ") in my code.
A. You should use [cc escaped="true"] or [cce] in the visual editor when inserting code into the post.

Q. Does it highlights my code on server or client side?
A. CodeColorer performs code highlighting on the server, you could see HTML of the highlighted code in page source.

Q. Is it produces valid XHTML source?
A. Yes, resulting XHTML is completely valid.

Q. Could my visitors insert their code snippets in comments?
A. Yes, CodeColorer supports code highlighting in comments using the same syntax, as you use in your blog posts.

Q. How can I disable syntax highlighting for a particular <code> block?
A. Use no_cc="true" option for your code block.

Q. I have updated the plugin to the newest version and now I keep getting following warnings:

1
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

A. Remove all files from wp-content/plugins/codecolorer folder and unpack an archive with plugin again (thanks to Anatoliy ‘TLK’ Kolesnick).

Q. I love this plugin. How to do a favor to the author?
A. Just vote for this plugin on WordPress.org. And thank you!

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 contact me. Promise, I will answer to every message.

If you want to contribute your code, see the Development section below.

Development

Sources of this plugin are available both in SVN and Git:

Feel free to check them out, make your changes and send me patches. 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. Also you have much more ways to contact me.

Changelog

  • 0.9.7 (December 19, 2009)
    • Fixed theme="geshi" attribute bug.
    • Added ability to highlight arbitary piece of code from PHP.
    • Use wp_enqueue_style instead of echoing plain HTML.
    • Fixed problem with escaped code blocks, when some entities were not unescaped.
    • Fixed compatibility with WordPress 2.9.
  • 0.9.6 (December 18, 2009)
  • 0.9.5 (August 27, 2009)
    • Added Dutch translation (thanks to Martijn van Iersel).
    • Added Spanish (Argentina) translation (thanks to Diego Sucaria).
    • Added Arabic translation (thanks to Amine Roukh).
    • Fixed bug in Safari 4 caused by text-align=justify in parent container.
  • 0.9.4 (August 24, 2009)
    • Version bump to 0.9.4 (for WordPress.org).
  • 0.9.3 (August 20, 2009)

Complete changelog could be found on the CodeColorer History page.

Other plugins

Full list of plugins I have implemented is available here.

192 Responses to this entry

Subscribe to comments with RSS or TrackBack to 'CodeColorer'.

said on 2007-04-01 at 11.34 pm · Permalink · Reply

Ага, но он принципиально отличается тем, что реализован на JavaScript и раскрашивает синтаксис на клиенте. Хотя признаю, решение красивое :-)

said on 2007-04-10 at 3.11 am · Permalink · Reply

Несколько неудобным показалось то, что само “окошко” фиксированной высоты. я о тех случаях когда надо написать буквально пару строчек кода.
Можно было бы реализовать через min-height(expression для ИЕ) + overflow:hidden…немного гармонии так сказать ;)

said on 2007-04-10 at 9.27 am · Permalink · Reply

Хм… для пары строчек высота блока не фиксируется. Вот пример:

1
2
$a = 'Hello';
echo $a . ' world';

Фиксируется только для блоков кода, высота которых больше заданной в настройках.

said on 2007-04-10 at 10.39 am · Permalink · Reply

Упс,прошу прощения. Зачит, трабл с плагином где-то у меня.

said on 2007-05-01 at 5.44 pm · Permalink · Reply

[...] Já no meu primeiro post tive essa dificuldade, tudo bem.. tem a tag <pre> ou até mesmo o CODE do WP, mas fala sério né.. sem nenhuma classe! Então navegando por ae, achei um plugin excelente que se chama CodeColorer. [...]

said on 2007-05-08 at 8.45 am · Permalink · Reply

[...] CodeColorer — Плагин на библиотеке GeSHi (Generic Syntax Highlighter), поддерживающей несметное количество языков (71, если быть точным). Плагин прост в установке и настройке. Вот пример работы этого плагина: [...]

said on 2007-05-20 at 11.59 am · Permalink · Reply

Установил. Запостил статью с блоками:

1
[cc lang="bash"]blablabla[/cc]

и

1
[cc lang="php"]blablabla[/cc]

Вместо этого текста при просмотре сайта отображается:

::CODECOLORER_BLOCK_1::

::CODECOLORER_BLOCK_2::

В чем дело?

said on 2007-05-20 at 1.09 pm · Permalink · Reply

А какая у вас версия плагина и вордпресса? И используете ли вы визуальный редактор?

said on 2007-05-21 at 12.57 am · Permalink · Reply

Стоял Wordpress 2.1.0 Русская версия с сайта maxsite.org
Плагин качал с Вас вчера.

Но уже там появилась 2.2.0 – с ней все ок.

Ну а с 2.1.0. разберитесь.

said on 2007-05-21 at 12.59 am · Permalink · Reply

Да и еще. Для подсветки синтаксиса конфигурационных файлов (apache, mysql, proftpd), чему лучше приравнивать параметр lang ?

said on 2007-05-21 at 1.01 am · Permalink · Reply

Еще замечание:

при вставке кода между тегами

[cc][/cc]

треугольных скобок они некорректно отображается :-(

said on 2007-05-21 at 1.14 am · Permalink · Reply

Mad Chicken: Большое спасибо за отзывы. Отвечу по порядку.

2.1.0 посмотрю, неожиданно как-то в нем сломалось.

Для подсветки кофигурационных файлов Apache язык apache, для конфига MySQL (если не ошибаюсь) подойдет ini, для самих запросов — mysql (либо просто sql, но тогда некоторые специфические для мускула вещи не подсветятся). Вот насчет ProFTPD — не знаю, возможно apache подсветит и его, уж больно похожи.

Насчет угловых скобок — это второй вопрос в секции ЧаВО чуть выше на странице. Съедает их вордпресс во время постинга в визуальном редакторе. Советую на время вставки примеров кода переключаться в редактор HTML (или вообще не использовать визуальный редактор ибо он от лукавого, постоянно лепит непонятные теги, причем не к месту).

Еще раз спасибо.

said on 2007-05-21 at 4.51 pm · Permalink · Reply

Мне кажется что проблему с угловыми скобками можно решить в самом плагине, например производить замену < на нужный символ. К тому же угловые скобки часто встречаются в конфигурационных файлах апача, Mysql итд. Ведь даже если в 1й раз переключишся в режим редактирования кода html, то при следующем редактировании статьи – оптять косяки вылезут.

Имхо можно решить проблему.

said on 2007-05-21 at 4.56 pm · Permalink · Reply

Я над этим работаю. Просто до этого времени основной задачей было исправить проблемы с XHTML и проблемами в комментариях. Сейчас образовалось немного времени на исправление этой багофичи вордпресса.

said on 2007-05-27 at 12.27 pm · Permalink · Reply

Подскажите, пожалуйста, как выделить код прямо в строке, без переноса, так, как у вас сделано на сером фоне с пунктиром?

said on 2007-05-27 at 12.57 pm · Permalink · Reply

У меня это сделано без CodeColorer, просто тег <tt>code</tt>, и в стилях поставил фон этому тегу. А за мысль спасибо, надо добавить в CodeColorer.

said on 2007-05-27 at 5.02 pm · Permalink · Reply

Ясненько.

Спасибо за этот плагин! Очень удобная штука.

said on 2007-06-03 at 3.07 pm · Permalink · Reply

Дмитрий, еще такой вопрос.

Если код состоит всего из одной строки и он меньше ширины страницы, т.е. не появляется горизонтальный скролл, то под этой строкой появляется отступ, который “забронирован” для скролла.

Не очень красиво это выглядит. Можно как-то исправить?

Adam
said on 2007-06-22 at 6.05 am · Permalink · Reply

I’m also getting ::CODECOLORER_BLOCK_1::. Using Wordpress 2.1 without the visual editor. Could you translate your response to Mad Chicken? Thanks!

said on 2007-06-30 at 6.12 am · Permalink · Reply

I am having a few problems with CodeColorer. First off, it seems that no matter what or where I set the tab_length to it equals 4. Also, if I post some code, and then go to edit it later, all of the tabs disappear. Is there any way that the CodeColorer could automatically insert tabs where it makes sense?

Bruno @
said on 2007-08-02 at 12.35 am · Permalink · Reply

Hi, I have a little (but horrible) problem with this plugin in my theme.

I use Freshy theme (http://www.jide.fr/) and line numbers appears in wrong mode. Like this:

1
First line of code
2
Second line of code
….
How can I correct this?

Thanks

Jan
said on 2007-08-29 at 7.51 am · Permalink · Reply
1
2
3
$awesome = "Dmytro";

echo $awesome . "rocks!!";
Cédric
said on 2007-10-07 at 4.29 pm · Permalink · Reply

Here my test :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
var myLoader:Loader = new Loader();
addChild(myLoader);
myLoader.load(new URLRequest('zoom_4-5.jpg'));
myLoader.contentLoaderInfo.addEventListener(Event.INIT, initListener);

function initListener(e:Event):void {
    Bitmap(myLoader.content).smoothing = true;
    stage.addEventListener(Event.RESIZE, resizeListener);
}

function resizeListener(e:Event):void {
    var scale_x = stage.stageWidth/1219;
    var scale_y = stage.stageHeight/609;
    var scale_global:Number;
    if(scale_x > scale_y) {
        scale_global = scale_y;
    }
    else {
        scale_global = scale_x;
    }
    myLoader.scaleX = scale_global;
    myLoader.scaleY = scale_global;

}
Zedr0n @
said on 2008-01-17 at 1.32 pm · Permalink · Reply

Спасибо, очень удобный плагин, а то <code> как-то не очень удобен для вставки кода.

P.S. OpenID(Oher OpenID) не работает – ругается на curl_init, проверь…

Rodrigo
said on 2008-01-18 at 8.27 pm · Permalink · Reply

Exist a client side (javascript) version of this plugin???

magik @
said on 2008-01-27 at 5.38 pm · Permalink · Reply

Спасибо огромное за плагин!
Всё отлично, но поддержу Mad Chicken в его просьбе решить проблему с угловыми скобками. Посчу много шел скриптов – а там угловые скобки чуть не в каждой строчке. Переправлять каждый раз когда вносишь изменение в пост утомляет.

Ещё раз спасибо за плагин! )

said on 2008-02-04 at 10.22 pm · Permalink · Reply

Спасибо за хороший плагин. Но у меня с ним тоже возникла проблема. При написании сообщения всё нормально сохраняется и выглядит в блоге. Но когда я решаю отредактировать написанный пост – то вместо нормального кода в редакторе вордпресса я вижу уже не то, что надо (например, если у меня был в коде тэг , то в редакторе его нет, просто переход на новую строку). И при повторном сохранении код уже портится. Что делать?

said on 2008-02-04 at 10.24 pm · Permalink · Reply

Тэг “br” я имел в виду, вордпресс и тут вырезал его из коммента. :)

said on 2008-02-09 at 3.07 pm · Permalink · Reply

[...] codecolorer благин с более обширным спектором возможностей: нумерация строк автоматическая вставка ссылок на документацию вычисление размера блока кода (короткий код будет заключен в маленький блок, для более длинного высота блока будет зафиксирована, и появятся полосы прокрутки) настройка стиля блока кода в Site Admin (Панель управления) настройка подсветки синтаксиса в файле CSS подсветка кода в комментариях защита кода от искажения Wordpress’ом (например, двойные кавычки, длинные тире и т.п. будут выглядеть в точности так, как Вы их ввели) [...]

said on 2008-03-17 at 3.47 pm · Permalink · Reply

Hi, I’ve been tested this script and it show me an line with error when I activated on Plugin’s Area (WordPress 2.3.3).

Error:

1
Fatal error: Cannot redeclare class GeSHi in /home/accountname/public_html/home/wp-content/plugins/codecolorer/lib/geshi.php on line 158

Is it normal?

said on 2008-03-17 at 4.00 pm · Permalink · Reply

Hi Raphael,
Looks like you have enabled another syntax highlighting plugin that uses GeSHi framework too. You must disable it before using CodeColorer.

said on 2008-03-18 at 2.14 pm · Permalink · Reply

после активации плагина вкладка “плагины” админки wordpress не открывается, сносишь плагин по FTP все сразу нормально. Странный баг какой-то

sergey
said on 2008-04-09 at 10.32 am · Permalink · Reply

у меня почему то при активации плагина выскакивает ошибка в коде с блогом
GeSHi Error: GeSHi could not find the language lang (using path /home/domain/domains/my_domain.com/public_html/wp-content/plugins/codecolorer/lib/geshi/)

said on 2008-04-24 at 4.49 pm · Permalink · Reply

[...] 其實可以搭配另一個外掛,那就是 CodeColorer,這個外掛,可以讓你在寫程式的時候加上顏色喔,相當方便,他支援的語法如下: actionscript, ada, apache, applescript, asm, asp, autoit, bash, blitzbasic, bnf, c, caddcl, cadlisp, cfdg, cfm, cpp-qt, cpp, csharp, css-gen.cfg, css, c_mac, d, delphi, diff, div, dos, eiffel, fortran, freebasic, gml, groovy, html, idl, ini, inno, io, java, java5, javascript, latex, lisp, lua, matlab, mirc, mpasm, mysql, nsis, objc, ocaml-brief, ocaml, oobas, oracle8, pascal, 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 [...]

said on 2008-06-13 at 7.31 am · Permalink · Reply

Большое спасибо, это действительно то что я искал, очень удобно и без лишнего гемора, особенно когда публикуешь фрагменты кода

said on 2008-06-17 at 3.33 am · Permalink · Reply

I have to say ‘Thank you’ first, I loooooooove this plugin!!!!

One small thing, I notice the code will remove the first spaces from the code because of ‘trim’, I use the following code instead and it fixed the problem.

p.s. it works fine with wp2.5.1

1
2
3
    $text = preg_replace("/^\s*\n/siU", "", $text);
    $text = rtrim($text);
#line 215    $text = trim($text);
said on 2008-06-18 at 12.12 pm · Permalink · Reply

I think I found a small bug
in comment if wrote several \ and a ' in the cc or code block, that comment won’t be posted!
if in post wrote several \ and a ' the result will be missing one \
I make a small change

1
2
    $text = str_replace("\\\"", "\"", $text);
#  $text = str_replace(array("\\\"", '\\''), array ("\"", '\''), $text);
said on 2008-07-25 at 12.28 am · Permalink · Reply

[...] CodeColorer обладает также рядом дополнительных интересных свойств, например, нумерацией строк, настройкой подсветки синтаксиса, подсветкой кода в комментариях и т.п. Модуль имеет достаточно широкий спектр настроек и большой список поддерживаемых языков. Единственное, что заставляет задуматься, это требования к версии wordpress – 2.1. Поэтому гарантии безотказной работы в более старших версиях нет. Подробнее о плагине на русском языке можете почитать в этом обзоре. [...]

said on 2008-07-25 at 4.24 pm · Permalink · Reply

I think I found 2 bugs.

1. If code snippets has only one line, his height is to small to display code.

1
var $one_line;

2. If there are some tabs in code I must to use parameter ‘tab_size’. Is there no default value?

said on 2008-07-25 at 4.25 pm · Permalink · Reply

Upsss. Here one line snippet looks properly. Why?

said on 2008-09-10 at 6.52 pm · Permalink · Reply

[...] CodeColorer обладает также рядом дополнительных интересных свойств, например, нумерацией строк, настройкой подсветки синтаксиса, подсветкой кода в комментариях и т.п. Модуль имеет достаточно широкий спектр настроек и большой список поддерживаемых языков. Единственное, что заставляет задуматься, это требования к версии wordpress – 2.1. Поэтому гарантии безотказной работы в более старших версиях нет. Подробнее о плагине на русском языке можете почитать в этом обзоре. [...]

said on 2008-12-31 at 9.38 am · Permalink · Reply
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
class Feed < ActiveRecord::Base

  SourceTypes = {
    :category => 0,
    :tag => 1
  }
 
  define_enum :source_type, :raise_on_invalid => true

  #-------------------------------------------------
  # Accessors

  def video_ids
    v = self[:video_ids]
    v ? v.split(':').map(&:to_i) : []
  end
end
said on 2009-01-01 at 3.07 am · Permalink · Reply

In SVN version of Wordpress 2.8 (bleeding edge) the options page doesn’t load, just an FYI. I am not sure if it’s something you will need to change for 2.8 or a problem with wordpress guys created in the trunk by accident with loading the plugin options. If I find out I will let you know. ‘Cannot load codecolorer-options.php.’

said on 2009-01-04 at 1.17 am · Permalink · Reply

It looks like the path changed slightly to:

1
wp-admin/options-general.php?page=codecolorer/codecolorer-options.php

Instead of

1
wp-admin/options-general.php?page=codecolorer-options.php
said on 2009-01-04 at 6.19 pm · Permalink · Reply

Hi there, thanks for the plugin…is the best of its kind so far. I have a question, it’s kind of dumb so please be gentile. I want to show some code but i have no idea what language is it…it’s some kind of C# but i am not shure. Is there a way to use in the code section something like “all”? Thanks:)

kduks
said on 2009-01-07 at 8.14 am · Permalink · Reply
1
2
3
 <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
  <mx:Button id="rang" />
</mx:Application>

Good
thx!

said on 2009-01-10 at 10.56 pm · Permalink · Reply
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
// Pre-2.6 compatibility
if( !defined('WP_CONTENT_DIR') )
define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );

if( !include( WP_CONTENT_DIR . '/wp-cache-config.php' ) )
return;
if( !defined( 'WPCACHEHOME' ) )
define('WPCACHEHOME', dirname(__FILE__).'/');

include( WPCACHEHOME . 'wp-cache-base.php');

if(defined('DOING_CRON')) {
require_once( WPCACHEHOME . 'wp-cache-phase2.php');
return;
}

$mutex_filename = 'wp_cache_mutex.lock';
$new_cache = false;

// Don't change variables behind this point

$plugins = glob( WPCACHEHOME . 'plugins/*.php' );
if( is_array( $plugins ) ) {
foreach ( $plugins as $plugin ) {
if( is_file( $plugin ) )
require_once( $plugin );
}

Тест!

rec
said on 2009-01-16 at 12.02 am · Permalink · Reply

When I try to change the options in WP2.7 (Cutline theme) the page goes into an infinite loop, I can only get out of it by moving the plugin directory. Any ideas?

said on 2009-01-18 at 1.40 am · Permalink · Reply

Are there any options to disable plugin action for marked elements? I mean sth like this: “code lang=”false”. I hope you get it :)

said on 2009-01-22 at 1.26 pm · Permalink · Reply

2dreame4: Will add this feature in next version (will be released at the end of this week).

said on 2009-01-19 at 12.09 am · Permalink · Reply

Огромное спасибо! Теперь при цитировании скриптов всё стало так аккуратно и красиво! :)

said on 2009-01-22 at 1.49 pm · Permalink · Reply

@Dmytro Shteflyuk: great information ;) And I noticed that there is a problem with validation your plugin. I mean converted <code&rt; is not validated. Do you take care of it?

said on 2009-01-27 at 6.41 pm · Permalink · Reply

2 dreame4: Just released CodeColorer v0.7.3 with new option:

1
<code no_cc="true">some code</code>
said on 2009-01-30 at 6.09 pm · Permalink · Reply

First – thanks for a great plugin!!
I have a minor feature request. Instead of specifying the width in pixels, I prefer to specify it in %, as my blog is not fixed width. This used to work in a previous version, but now it seems that px is hard-coded in.

Thanks.

Rob

said on 2009-01-31 at 9.56 pm · Permalink · Reply

2 Andrias: looks like you forgot to add opening <php tag at the beginning of the code block.

said on 2009-01-31 at 10.30 pm · Permalink · Reply

Yes I know, but that is actually intentional. The code that I show is meant to be “copy and paste” code, and I don’t want any tags at the end.

said on 2009-01-31 at 11.52 pm · Permalink · Reply

Ok, I see the problem. In current version you should add opening tag at the beginning of the code. I will try to figure out this limitation in future releases. Thank you for your feedback!

said on 2009-02-01 at 12.29 pm · Permalink · Reply

Hey Robert,

Your suggestion makes sense, will take a look at this problem in nearest release.

Kevin @
said on 2009-02-03 at 8.54 pm · Permalink · Reply

Hi,

I seem to be having trouble, nothing shows up – the html code is there (view source) but there is nothing being shown. Just a grey bar… any ideas?

Kevin

said on 2009-02-11 at 5.18 pm · Permalink · Reply

Thanks Dmytro for the nice plugin.

Is there a way to change the font family?

I have tried changing the font-family property in the .codecolorer-container * selector, but it seems that the default font-family (Monaco, Lucida Console, monospace) is applied automatically and directly to the codecolorer div. The result is that some of the code (anything outside a span) is displayed using the default font-family, and the rest is displayed using the one I want.

Maybe there is a better way to do it, but I can’t figure it out.

said on 2009-02-16 at 12.00 pm · Permalink · Reply

Funktiu addContainer bila bi lutshe wot tak (potomutshto u menja Problememi s CSS autowidth):

1
2
3
4
5
6
7
8
9
10
11
12
13
function addContainer($html, $options, $num_lines) {
    $style = 'style="overflow:auto;white-space:nowrap';
        if( $options['width'] > 0 ) {
            $style .= ';width:' . $options['width'] . 'px';
        }
    if($num_lines > $options['lines'] && $options['lines'] > 0) {
      $style .= ';height:' . $options['height'] . 'px';
    }
    $style .= '"';

    $result = '<div class="codecolorer-container ' . $options['lang'] . ' ' . $options['theme'] . '" ' . $style . '>' . $html . '</div>';
    return $result;
  }
said on 2009-02-22 at 3.47 am · Permalink · Reply

Hi Dmytro,

I like CodeColorer very much…a big up for your work. Today I implemented a nifty view toggler utilizing JQuery. Take a look at http://wordpress.org/support/topic/246260?replies=1 where everything further can found. Maybe a potential feature in one of the future releases?

Best regards from germany,

:peter

Andrew
said on 2009-03-04 at 3.37 pm · Permalink · Reply

How would I reduce the font size for the entire code block including line numbers. I’ve tried per class customization (as above), but that seems to leave some keywords/classes untouched or the code isn’t alligned with the line numbers.
Is there a master css class or set that will include everything?

ChaosNo1 @
said on 2009-03-10 at 12.12 pm · Permalink · Reply

Hi,

I really like your plugin, but i need it to get working within the simple:press forum (http://simplepressforum.com) because i would give visitors the opportunity to post colored code.

How can i do this?
Thank you!

said on 2009-03-13 at 8.34 pm · Permalink · Reply

Great little plug-in, miles better than any of the other code highlighters I’ve experimented with.

One thing though, for some reason it wouldn’t pick up any of the CSS styling until I copied the codecolorer.css file to my theme’s directory and put in a link in my header.php to it.

said on 2009-03-17 at 7.04 pm · Permalink · Reply

Привет. Ставлю твой плагин, активирую и белая страница, делю плагин из папки все гуд, что не так? вордпресс 2.7.1 русский.

smao
said on 2009-03-29 at 12.53 pm · Permalink · Reply
1
/*REALLY a good job. :) */
Serguei
said on 2009-03-31 at 12.33 am · Permalink · Reply

I have as similar issue as Kevin, nothing shows up while the html source seems valid.
This is what I am trying to display:

1
2
3
def testFunction ():
    ''' This is a test function '''
    print "Testing ..."
Serguei
said on 2009-03-31 at 1.03 am · Permalink · Reply

Could it be possible that my theme is somehow overwridding the css used for displaying the code?

Serguei
said on 2009-03-31 at 1.15 am · Permalink · Reply

Tested with default themes and still a no go!

Aa
said on 2009-04-06 at 7.03 pm · Permalink · Reply
1
2
3
4
5
6
7
8
9
10
11
12
13
14
piper = Baby.new(:name => 'Piper',
                 :born => '2008-06-09 18:22:00 EDT',
                 :weight => {:lbs => 6, :oz => 8},
                 :length => {:inches => 21.25})

skoglunds.children << piper

piper.daily do |p|
  8.times do
    p.eat
    p.poop
    p.sleep
  end
end
said on 2009-04-08 at 6.36 am · Permalink · Reply

У меня подсветка Java кода отображается некорректно после символа @ в коде. Посмотрим, как у вас.

1
2
3
4
5
6
class Test {
    @Override
    public String toString() {
         return "Test";
    }
}
Артем
said on 2009-04-27 at 4.44 pm · Permalink · Reply

Добрый день.
Есть предложение насчет улучшения плагина.
Итак хотелось бы получить такой же функционал как и в этом плагине syntaxhighlighter-plus. Т. е. менюшки сверху и такуюже тему оформления defaut.
Насчет дополнения функционала можно просто скрестить 2 плагина – так получатся менюшки.
А как перенести тему defaut в CSS еще не знаю.

said on 2009-05-04 at 6.46 pm · Permalink · Reply

Great plug-in, really useful. Can I add a vote for width to be specified in percentage? If I make it look just right on the PC, mobile browsers have heart attacks ;)

said on 2009-05-05 at 6.05 pm · Permalink · Reply

In codecolorer.php I would change

1
2
3
  function addCssStyle() {
        echo '<link rel="stylesheet" href="' . get_option('siteurl') . $this->pluginLocation . 'styles.php" type="text/css" />', "\n";
  }

to

1
2
3
4
5
6
  function addCssStyle() {
        if (trim(get_option('codecolorer_css_style'))!='')
                echo '<link rel="stylesheet" href="' . get_option('siteurl') . $this->pluginLocation . 'styles.php" type="text/css" />', "\n";
        else
                echo '<link rel="stylesheet" href="' . get_option('siteurl') . $this->pluginLocation . 'codecolorer.css" type="text/css" />', "\n";    
  }

because that way, the STYLES.PHP is only called if its really necessary.

And if I were you I wouldn’t store the additional CSS in the options at all but in an additional CSS-files because your “styles.php” requires “wp-load.php” and this takes a long time to load. And this only happens because you need the getoption-function.

said on 2009-05-13 at 10.48 pm · Permalink · Reply

Thank you very much for this beautyful plugin!

I’m getting it to work really fine in wordpress. With enthusiasm!

Some small observations:
Setting the tabsize to less than 4 in the options panel doesn’t seem to change it, it still shows “4″ after a submit change and reload.
Then I think the stules for xml in the default theme write:

.twitlight .xml .re1 { color: #008080; }
/* Constant */
.twitlight .xml .re0 { color: #0080A0; }
– the exact same as in the twitlight theme.

Then actionscript3 misses the ‘extend’ method. I’ve written a comment on the SELD BE blog about it.

Any chance the themes not used could be ommitted in the loaded documents? It seems like a lot of css to load, then to override..

But this is fun and your plugin is wonderful!

regards and thanks
Kamilla

said on 2009-05-20 at 10.23 am · Permalink · Reply

hi, I’m simaopig.

I want know how i can set the keyword link open in new tab or new window?

Hope your mail. Thank you!

said on 2009-05-30 at 2.24 pm · Permalink · Reply
1
2
3
4
5
6
7
8
#import <UIKit/UIKit.h>

int main(int argc, char *argv[]) {
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    int retVal = UIApplicationMain(argc, argv, nil, nil);
    [pool release];
    return retVal;
}
said on 2009-05-30 at 2.25 pm · Permalink · Reply
1
2
3
4
5
6
7
8
#import <UIKit/UIKit.h>

int main(int argc, char *argv[]) {
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    int retVal = UIApplicationMain(argc, argv, nil, nil);
    [pool release];
    return retVal;
}
said on 2009-05-30 at 2.26 pm · Permalink · Reply
1
2
3
4
5
6
7
8
#import <UIKit/UIKit.h>

int main(int argc, char *argv[]) {
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    int retVal = UIApplicationMain(argc, argv, nil, nil);
    [pool release];
    return retVal;
}
said on 2009-05-30 at 2.27 pm · Permalink · Reply
1
2
3
4
5
6
7
8
#import <UIKit/UIKit.h>

int main(int argc, char *argv[]) {
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    int retVal = UIApplicationMain(argc, argv, nil, nil);
    [pool release];
    return retVal;
}
Brett Z
said on 2009-05-31 at 4.29 am · Permalink · Reply

Hi there,

Was wondering if you could just make one small fix to your very useful plugin–

Change line 135 of codecolorer.php to:

1
$table = '<table class="line-numbering"><tbody><tr><td class="line-numbers"><div>';

Then add to codecolorer.css:

1
.line-numbering {border-collapse: collapse; padding:0px;

Or something semantically named like “line-numbering”.

I’m a bit of a nut of separating formatting from structure, even if it is not 100% clear yet on whether HTML5 will remove the cellpadding and cellspacing attributes (since the spec is still in draft), I still think it’s a good practice to follow it.

And this is just an idea but, although there are no namespaces in CSS, I wonder whether using “:” or “.” in the class name might help ensure that there were no collisions when including another CSS library. Of course, that’d be more work, but just an idea. Maybe prefix the attributes with “cc:” or something?

Thank you!

Brett Z
said on 2009-05-31 at 4.31 am · Permalink · Reply

Sorry, I of course meant prefix the class attribute values, not the attribute (name).

marcus
said on 2009-06-26 at 1.11 am · Permalink · Reply

hey there -

thanks for the plugin! a quick question – how do you add a “TAB symbol?”

much appreciated.

said on 2009-07-13 at 11.25 am · Permalink · Reply

After updating to Wordpress 2.8.1 i can’t access the options-page of codecolorer. Could you fix that?

said on 2009-07-13 at 5.10 pm · Permalink · Reply

To codesnippet: sorry for this weird problem. Fixed in 0.8.1 (already on wordpress.org and will be available using automatic update very soon). Thank you for report.

said on 2009-07-13 at 5.58 pm · Permalink · Reply

Dmytro Shteflyuk, thank you for this plugins and thank for fix the problem.

said on 2009-07-13 at 6.20 pm · Permalink · Reply

Sorry for my double post.. i found other problem… in rss feeds i see code correcly only IE but Firefox and Opera have some problem to interpret it. Is problem for firefox and Opera or is problem the script?

an other one problem, i don’t know, but, now, i can’t set the height for block.. the block of code is equal to lines of code.. and not is equal at pixel can i set on administration panel. For example, before, in this page (http://codesnippet.altervista.org/conto-alla-rovescia-in-javascript/) i have the vertical scrool.. now, for only value in the height box, i see all code.

Thank you e sorry again for my english..

said on 2009-07-13 at 6.26 pm · Permalink · Reply

sorry again for triple post :D . I can traslate your script in italian language if is not problem for you.. tell me.. ;)

test
said on 2009-07-14 at 2.12 am · Permalink · Reply
1
$a = "hello";

————–

1
$a = "hello";
said on 2009-07-14 at 4.20 am · Permalink · Reply

To codesnippet: height problem has been fixed in version 0.8.2, which will be pushed out later today (or tomorrow). Italian translation would be really great!

said on 2009-07-14 at 4.26 am · Permalink · Reply

I’ve update it to 0.8 ,but i didn’t see style.php in my plugin.

So it didn’t work right,and i use the old version now..

said on 2009-07-14 at 4.30 am · Permalink · Reply

There is no need for styles.php now, because it really slows down the whole site. Instead plain old CSS file + a little of custom CSS in page head will be used. Hope you will appreciate it.

Also make sure you are installed 0.8.1 since 0.8.0 has weird bug with styles inclusion.

said on 2009-07-14 at 10.35 am · Permalink · Reply

In the last version compare two warning when i paste php code

1
2
3
Warning: preg_match() [function.preg-match]: Compilation failed: unrecognized character after (?< at offset 3 in /membri/codesnippet/wp-content/plugins/codecolorer/lib/geshi.php on line 2132

Warning: preg_match() [function.preg-match]: Compilation failed: unrecognized character after (?< at offset 3 in /membri/codesnippet/wp-content/plugins/codecolorer/lib/geshi.php on line 2132
said on 2009-07-14 at 11.20 am · Permalink · Reply

Which version of PHP do you use? Looks like latest GeSHi has a problem with old PHP releases.

said on 2009-07-14 at 1.49 pm · Permalink · Reply

Ok. I have read the geshi source sode…

1
2
 if(!GESHI_PHP_PRE_433 && //Needs proper rewrite to work with PHP >=4.3.0; 4.3.3 is guaranteed to work.
                           preg_match($delimiters, $code, $matches_rx, PREG_OFFSET_CAPTURE, $i))

this is the interested line..

Not is an problem the script.. but my hosting using a version of PHP < 4.3.0.

said on 2009-07-14 at 1.57 pm · Permalink · Reply

Looks like the easiest way for you to fix this error is to replace following lines in lib/geshi/php.php:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
        4 => "/(?<start><\\?(?>php\b)?)(?:".
            "(?>[^\"'?\\/<]+)|".
            "\\?(?!>)|".
            "(?>'(?>[^'\\\\]|\\\'|\\\\\\\|\\\\)*')|".
            "(?>\"(?>[^\"\\\\]|\\\\\"|\\\\\\\\|\\\\)*\")|".
            "(?>\\/\\*(?>[^\\*]|(?!\\*\\/)\\*)*\\*\\/)|".
            "\\/\\/(?>.*?$)|".
            "\\/(?=[^*\\/])|".
            "<(?!<<)|".
            "<<<(?<phpdoc>\w+)\s.*?\s\k<phpdoc>".
            ")*(?<end>\\?>|\Z)/sm",
        5 => "/(?<start><%)(?:".
            "(?>[^\"'%\\/<]+)|".
            "%(?!>)|".
            "(?>'(?>[^'\\\\]|\\\'|\\\\\\\|\\\\)*')|".
            "(?>\"(?>[^\\\"\\\\]|\\\\\"|\\\\\\\\|\\\\)*\")|".
            "(?>\\/\\*(?>[^\\*]|(?!\\*\\/)\\*)*\\*\\/)|".
            "\\/\\/(?>.*?$)|".
            "\\/(?=[^*\\/])|".
            "<(?!<<)|".
            "<<<(?<phpdoc>\w+)\s.*?\s\k<phpdoc>".
            ")*(?<end>%>)/sm",

with these:

1
2
        4 => "/(<\?(?:php)?)(?:'(?:[^'\\\\]|\\\\.)*?'|\"(?:[^\"\\\\]|\\\\.)*?\"|\/\*(?!\*\/).*?\*\/|.)*?(\?>|\Z)/sm",
        5 => "/(<%)(?:'(?:[^'\\\\]|\\\\.)*?'|\"(?:[^\"\\\\]|\\\\.)*?\"|\/\*(?!\*\/).*?\*\/|.)*?(%>|\Z)/sm"
miaow
said on 2009-07-14 at 5.54 pm · Permalink · Reply

something wrong with latest version, the “disable showing lines” doesn’t work!

said on 2009-07-15 at 11.06 am · Permalink · Reply

Do you know ? The new version for mysql is wrong.

The Link is wrong ,and the code is not right.

You can test.

By the way , I like it ,So I hope it wonderful.Thank you.

said on 2009-07-15 at 11.07 am · Permalink · Reply
1
2
3
4
5
6
7
8
/*
创建一个qq表,将qq_id设为主键,且没有对其进行NOT NULl约束
*/

create table qq(
qq_id int(10),
nick_name varchar(255) not null,
primary key (qq_id)
)
said on 2009-07-15 at 11.09 am · Permalink · Reply

Ah ha, I know ,if use the link to the mySql doc ,it’s wrong..

You can test..EN..

said on 2009-07-15 at 11.12 am · Permalink · Reply

Not at all, hope your new version.

Sorry, my english is poor..(*^__^*) ……

said on 2009-07-20 at 10.56 am · Permalink · Reply

Hi Dmytro,

I found a bug in the latest version. In codecolorer-options.php, the following line:

1
update_option('codecolorer_tab_site', intval($_POST['codecolorer_tab_size']));

As you can see, its updating the ‘codecolorer_tab_SITE’ variable in the database instead of the ‘codecolorer_tab_SIZE’ variable. This makes it impossible to edit the default tab size in the codecolorer settings unless you manually edit the database entry. :-)

said on 2009-07-20 at 10.58 am · Permalink · Reply

Oh I forgot to tell you thank you for the great library Dmytro! Its clearly the best syntax highlighter out there for WP.

said on 2009-07-24 at 1.02 am · Permalink · Reply

>Исправлена проблема, блокирующая доступ к странице
>настроек CodeColorer в WordPress 2.8.1.

Подскажи как исправил?

said on 2009-07-24 at 1.14 am · Permalink · Reply

> Добавлена возможность задавать высоту и ширину блока в
> пикселях, em, процентах.

Огромное спасибо!

said on 2009-07-24 at 1.17 am · Permalink · Reply

Думаю, стоит добавить параметр:
* Минимальное количество строк для активации “показа номера строк”

А то когда 1-3 строки, то выводить номер строки как-то не актуально…

said on 2009-07-24 at 2.01 am · Permalink · Reply

2adw0rd: В WordPress 2.8 переработали систему безопасности, и теперь добавлять страницы настроек можно только из action’а admin_menu (раньше работало и из admin_init).

А насчет отключения номеров строк — с новыми короткими кодами, имхо, проблема разрешилась сама собой.

1
[ccN_php]тут код без номеров строк[/ccN_php]

Про короткие коды пока что можно почитать здесь, завтра обновлю эту страницу (и переведу на русский).

ЗЫ. В ближайшие дни готовится масштабное обновление (сильно переписан движок и исправлена туча мелких ошибок).

said on 2009-07-24 at 9.00 am · Permalink · Reply
В WordPress 2.8 переработали систему безопасности, и теперь добавлять страницы настроек можно только из action’а admin_menu (раньше работало и из admin_init).

Спасибо!

Я юзаю включение номера строк так: line_numbers="true" и меня устраивает :)

Jürgen
said on 2009-07-29 at 2.03 pm · Permalink · Reply

Just a simple question:
How can I define the fontstyle, such as size and face?
Thanks for your reply.
Jürgen

said on 2009-07-31 at 9.43 pm · Permalink · Reply

Слушай, я думаю необходимо исключать подгрузку всех css-стилей, когда нужен только один.

/wp-content/plugins/codecolorer/codecolorer.css

said on 2009-08-01 at 7.12 pm · Permalink · Reply

Очень хороший плагин, спасибо.
Но у меня недавно возникла проблема… вместо подсвеченного кода появилась строка ::CODECOLORER_BLOCK_1::… до вчерашнего дня было все нормально… обновился и появился этот текст.

Версия WP – 2.8.2–ru

Erik
said on 2009-08-01 at 10.00 pm · Permalink · Reply

Hi,

Is it possible to set a default language? Or would it be possible to make it such that a [cc] tag remembers the settings from the previous [cc] tag on the same page so we just have to define it somewhere once?

Jürgen
said on 2009-08-03 at 2.11 pm · Permalink · Reply

Hallo,
is that the answer for my question?
I’m so sorry, i can’t understand any of your russian??? language.
OK, maybe you mean, I have to edit the codecolorer.css.
Can you give me some hints where in the Codecolorer.css-file i have to edit.
Thanks Jürgen

Thomas
said on 2009-08-10 at 3.04 pm · Permalink · Reply

Hi,

all I get from CodeColorer is this one line:

::CODECOLORER_BLOCK_1::

The actual code is not printed; looks pretty much like comment #9 from Mad Chicken. I am using CodeColorer 0.9.2 on WP 2.8.3. Any idea?

Thanks in advance
Thomas

said on 2009-08-11 at 7.10 am · Permalink · Reply

The plugins doesn’t work as expected in WordPress-mu… don’t know if missconfiguration or what, but the editor everytime I try to add code (pasted or by keyboard), translates the special characters like < or " to entities… and the result page is showed with the entities…

said on 2009-08-14 at 7.38 pm · Permalink · Reply

I send you polish translation of CodeColorer – let me know if everything is ok.

Anon
said on 2009-08-16 at 2.53 am · Permalink · Reply

If you get this ::CODECOLORER_BLOCK_1::, you must use PHP 5 on MediaTemple servers…

ctapmex
said on 2009-08-19 at 10.18 am · Permalink · Reply

Привет.
что то не могу разобраться с tab. как его вставить в визуальный редактор? вставляю код из VS2008 , там точно таб стоит перед строкой. но при сохранении и табы и пробелы удаляются. wp 2.84

ctapmex
said on 2009-08-19 at 10.47 am · Permalink · Reply

хотя, это кажется глюк оперы и tinymce
в ie все отлично

said on 2009-08-22 at 2.35 pm · Permalink · Reply

Hey, thanks for the nice plugin, but it looks like CodeColorer is broken for wordpress 2.8.4 At least all I’m getting is ::CODECOLORER_BLOCK_1:: where I expect a snippet of code.

Is this a known problem?

said on 2009-08-25 at 6.07 pm · Permalink · Reply

i would like to know if you would address this error which for the mysql link is wrong??

3Q.

Bughunter @
said on 2009-08-25 at 6.50 pm · Permalink · Reply

Concerning the error message ‘compilation failed…’ using PHP < 4.3.3 you need an older version of Geshi (1.0.6 seems to work)

said on 2009-08-28 at 5.51 pm · Permalink · Reply

First of all, love the plugin, just one ‘request’ allow us to specify the starting line number with the CC tag.

i.e.

1
2
3
4
<?PHP
$changeme = 1;
$butnotme = 2;
?>

You should change line 2 not line 3

Change this

1
$changeme = 1;
said on 2009-09-09 at 2.19 am · Permalink · Reply

Hi! First of all, thanks for the great plugin. I’ve just got one problem with it: no matter what I do, Wordpress seems to be stripping the spaces from the start of each line of my code, so that:

class Foo {
function bar() { }
function baz() { }
function quux() {
doFoo();
}
}

comes out as:

class Foo {
function bar() { }
function baz() { }
function quux() {
doFoo();
}
}

The only way around this seems to be to use a tag, but this then messes up the formatting. What should I do?

@Buzz: There is already support to do that: see the “first_line” parameter.

said on 2009-09-09 at 2.22 am · Permalink · Reply

Well this went wrong here too. Let me try again:

1
2
3
4
5
6
7
class Foo {
  function bar() { }
  function baz() { }
  function quux() {
    doFoo();
  }
}

is what I intend, but:

1
2
3
4
5
6
7
class Foo {
function bar() { }
function baz() { }
function quux() {
doFoo();
}
}

is the output I get (when using the visual editor and either the “cc_php” or “cce_php” shortcodes.

said on 2009-10-15 at 6.30 pm · Permalink · Reply

Any advice on using CodeColorer with the TinyMCE Advanced visual editor?

Seems that I get either my code right, or my paragraphs right… but not both.

I saw you had a TinyMCE plugin, but have revoked it, any thoughts on re-entering it into the codebase?

BTW:

1
echo "BIG THANKS!";
said on 2009-10-16 at 12.08 pm · Permalink · Reply

Yep, TinyMCE editor is a big problem for now. I’ve started working on a TinyMCE plugin for CodeColorer, but this functionality has been disabled due to weird bugs in markup produced by rich editor. Hope, it will be fixed

said on 2009-10-16 at 12.22 pm · Permalink · Reply

I’m so sorry .

But i didn’t see the answer of the question “mysql link wrong” ..

dr34m3r @
said on 2009-10-24 at 5.32 pm · Permalink · Reply

This is the best code highlighter plugin of all. Just voted for the plugin at wordpress.org. My highest appreciation to you my friend. Thanks a lot for this plugin.

said on 2009-11-04 at 12.11 am · Permalink · Reply

[...] 2009, under Uncategorized Just found and installed the CodeColour plugin by Dmytro Shteflyuk (See here and (no I’ve no idea how to pronounce his name either ). It’s easy to find in the [...]

said on 2009-11-17 at 10.06 pm · Permalink · Reply

Thanks for the wonderful add-in.

I’m having a little problem. When I’m checkin the post page, the add-in works fine. However, I’m having problems on my main page where the cc blocks appear instead.

Also, I tried us the VB language and the comment don’t seem to be recognized.

Sébastien

Tsalagi @
said on 2009-12-24 at 5.10 am · Permalink · Reply

Is this plugin supported on this website. If so I need some solutions to two issues.
1. When I use <code> it removes my text from my page.
2. When I set a theme I still get no colors on the code on my page.

Thanks in advance.

Tsalagi
said on 2009-12-24 at 5.12 am · Permalink · Reply

Try again.
1. When I use no_cc="true" my text is removed from my page.

said on 2009-12-24 at 3.23 pm · Permalink · Reply

Добрый день, подскажите как то можно сделать чтобы когда человек вводит
{code lang=”"}тут текст{code} (специально заменил)
не вылазила ошибка, вот такая:

1
<code>тут текст<code>

У меня стоит последняя 0.9.7 версия, версия WordPress 2.7.1

said on 2009-12-24 at 3.25 pm · Permalink · Reply

странно у вас не появилась ошибка, у меня пишет:

1
GeSHi Error: GeSHi could not find the language (using path /wp-content/plugins/codecolorer/lib/geshi/) (code 2)
Douglas
said on 2009-12-29 at 5.57 am · Permalink · Reply

Hi. There is a problem in your code that appear when yout set an image as background. To verify that creates a “stripe” image (www.stripegenerator.com) and add it as background (in codecolorer.css ) and you will see a continuity break (set the width as 100% in the plugin options). I searched in the code and I saw that the cause is the way that you show the line numbers. You calculate the numbers manually and create a table to show them. So there is a conflict between the end of the table and the rest of the container that you create to apply the user options. I solved in two ways. The simplest is to put a width=”100%” in your second , so the table will fill all the container space.
The second is to use the Geshi methods to show the lines:

1
2
$geshi->start_line_numbers_at($options['first_line']);
$geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS);

deleting the creation of the table.

thanks.

said on 2009-12-29 at 12.34 pm · Permalink · Reply

I don’t like Geshi line numbers because when you copy code, browser copies them too. It’s really weird thing, so I ended up with this table implementation. Your point about 100% makes sense, I’ll take a look how it will impact code blocks layout.

Post a comment

You can use simple HTML-formatting tags (like <a>, <strong>, <em>, <ul>, <blockquote>, and other). To format your code sample use [cc lang="php"]$a = "hello";[/cc] (allowed languages are ruby, php, yaml, html, csharp, javascript). Also you can use [cc][/cc] block and its syntax would not be highlighted.

Submit Comment