MT Colorer was only tested with Movable Type 3.2. It may work with other 3.* versions. It is not compatible with older 2.* versions.
The first step is to install Syntax::Highlight::Universal perl package. Since that package relies on colorer, which is a C++ library, the installation process involves compilation. If you don't feel comfortable with that, you should ask your hosting provider to install the package for you. I will describe the configuration process in a later article. Also you can download precompiled versions for some OSes.
The second step is to install MT Colorer itself:
<link rel="stylesheet" type="text/css" media="all" href="/mtcolorer.css" />
For syntax highlighting you can use one of the following tags
<mtc:block lang="[source_code_language]">
[source_code]
</mtc:block>
or
<mtc:inline lang="[source_code_language]">[source_code]</mtc:inline>You should use <mtc:block> for multiline pieces of code, and <mtc:inline> for code embedded in text. Exaples are available here.
List of supported languages: c, cpp, asm, perl, java, idl, pascal, csharp, jsnet, vbnet, forth, fortran, vbasic, html, css, html-css, svg-css, jsp, php, php-body, xhtml-trans, xhtml-strict, xhtml-frameset, asp.vb, asp.js, asp.ps, svg, coldfusion, jScript, actionscript, vbScript, xml, dtd, xslt, xmlschema, relaxng, xlink, clarion, Clipper, foxpro, sqlj, paradox, sql, mysql, Batch, shell, apache, config, hrc, hrd, delphiform, javacc, javaProperties, lex, yacc, makefile, regedit, resources, TeX, dcl, vrml, rarscript, nsi, iss, isScripts, c1c, ada, abap4, AutoIt, awk, dssp, adsp, Baan, cobol, cache, eiffel, icon, lisp, matlab, modula2, picasm, python, rexx, ruby, sml, ocaml, tcltk, sicstusProlog, turboProlog, verilog, vhdl, z80, asm80, filesbbs, diff, messages, text, default
Currently, if defined language is not supported, movable type will throw an error during rebuild process.
<pre class="mtc_block"> [source_code] </pre>and
<span class="mtc_inline">[source_code]</span>Other css classes are using by Syntax::Highlight::Universal package. Unfortunately there is no good documentation for this part, but Syntax::Highlight::Universal distibutions includes several color schemes, and I hope you can choose one.
If you find a bug or have some problems using MT Colorer, please, mail me to klimontovich@gmail.com. I'll try to help.
Here you can download compiled versions of Syntax::Highlight::Universal for Linux and FreeBSD. I'm not the specialist in binary compatibility, so I can't give any warranty, that this packages will work under various versions of Linux and FreeBSD.
To install, just unpack archives and place its content into MT_DIR/extlib.
| © Vladimir Klimontovich; modified: Thursday, 13-Dec-2007 06:13:57 PST |