Linux 软件免费装
Banner图

CodeColorer

开发者 kpumuk
更新时间 2023年5月29日 08:58
PHP版本: 4.0 及以上
WordPress版本: 6.2.2

标签

code color snippet syntax highlight highlighting geshi

下载

0.10.1 0.6.0 0.7.0 0.7.3 0.8.1 0.8.2 0.8.3 0.9.11 0.9.12 0.9.13 0.9.14 0.9.15 0.9.16 0.9.2 0.9.3 0.9.4 0.9.5 0.9.6 0.9.7 0.10.0 0.7.2 0.8.0 0.9.8 0.9.9 0.5.1 0.8.4 0.8.5 0.8.6 0.8.7 0.9.0 0.9.1 0.9.10

详情介绍:

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: 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. Promise, I will answer every email I received. If you want to contribute your code, see the Development section under the Other Notes tab.

安装:

  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</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).
  5. Have fun!
Syntax 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. Short codes 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. Possible parameters 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] [cc lang="html"] CodeColorer short code colorized [/cc] [/cce_bash]

屏幕截图:

  • Ruby syntax highlighting with scrollbars (Twitlight theme).
  • Inline code syntax highlighting.
  • Settings page.

常见问题:

How do I can customize CodeColorer CSS rules?

Go to the Options/CodeColorer page in Site Admin and change the "Custom CSS Styles" option.

I see < instead of < (or other HTML entities like >, &, ") in my code.

You should use [cc escaped="true"] or [cce] in the visual editor when inserting code into the post.

Does it highlights my code on server or client side?

CodeColorer performs code highlighting on the server; you could see HTML of the highlighted code in the page source.

Is it produces valid XHTML source?

Yes, resulting XHTML is completely valid.

Could my visitors insert their code snippets in comments?

Yes, CodeColorer supports code highlighting in comments using the same syntax, as you use in your blog posts.

How can I disable syntax highlighting for a particular <code> block?

Use <code no_cc="true"> option for your code block.

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

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). = How to insert code from an external file? 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. = Google Website Translator breaks my code blocks The solution is to add notranslate class to the list of "Custom CSS Classes" on the admin plugin settings page. = Is this plugin GDPR Compliant? Yes. We do not store or process any user information.

更新日志:

0.10.1 (May 28, 2023) 0.10.0 (April 28, 2023) 0.9.16 (July 23, 2018) 0.9.15 (February 24, 2017) 0.9.14 (October 25, 2017) 0.9.13 (October 24, 2017) 0.9.12 (October 12, 2017) 0.9.11 (August 8, 2017) 0.9.10 (July 28, 2017)