[WordPress] 外掛分享: CodeColorer

首頁外掛目錄 › CodeColorer
WordPress 外掛 CodeColorer 的封面圖片
1,000+
安裝啟用
★★★★
4.9/5 分(11 則評價)
5 天前
最後更新
問題解決
WordPress 4.0+ PHP 7.0+ v0.11.0 上架:2007-04-08

內容簡介

CodeColorer 是一款能夠在文章、評論及 RSS 提要中插入語法高亮的程式碼片段的外掛。它基於 GeSHi 函式庫,支援多種程式語言,並提供多種自訂功能,讓開發者能夠輕鬆展示程式碼。

【主要功能】
• 支援多種程式語言的語法高亮
• 在 RSS 提要中顯示語法高亮
• 自訂 CSS 文件中的語法顏色
• 自動插入文件連結
• 智能滾動檢測程式碼區塊
• 預定義的顏色主題選擇

外掛標籤

開發者團隊

⬇ 下載最新版 (v0.11.0) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「CodeColorer」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

CodeColorer lets you insert syntax-highlighted code snippets into posts, comments, and feeds.
CodeColorer currently bundles GeSHi 1.0.9.0 from the upstream 1.0.x line, with a small set of project-local maintenance patches for current PHP and WordPress compatibility.
Plugin based on GeSHi library, which supports most languages. CodeColorer has various nice features:

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

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 [email protected]. I will try my best to answer you.
If you want to contribute your code, see the Development section under the Other Notes tab.
Supported languages
Here is the list of languages supported by CodeColorer: 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, icon, idl, ini, inno, intercal, io, ispfpanel, j, java, java5, javascript, jcl, jquery, 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.
Development
Sources of this plugin are available both in SVN and Git:

WordPress SVN repository
GitHub

The GitHub repository includes local contributor tooling based on mise, Composer, pnpm, and wp-env. A typical setup is:

mise install
mise run bootstrap
mise run test
mise run wp-start

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.
Customization
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 a simple mapping 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.

延伸相關外掛

文章
Filter
Mastodon