| 1 | Color Highlighting in posts. |
|---|
| 2 | |
|---|
| 3 | It's possible to specify a part of a post to be code with syntax color highlighting. |
|---|
| 4 | This document gives some pointers and examples on how you can do this. |
|---|
| 5 | |
|---|
| 6 | Syntax: |
|---|
| 7 | [code:<language> |
|---|
| 8 | <code> |
|---|
| 9 | :code] |
|---|
| 10 | |
|---|
| 11 | <example> |
|---|
| 12 | |
|---|
| 13 | Some php code: |
|---|
| 14 | [code:php |
|---|
| 15 | <?php |
|---|
| 16 | $ts = mktime(); |
|---|
| 17 | $date = date("m-d-Y", $ts); |
|---|
| 18 | echo "timestamp = $ts and date = $date"; |
|---|
| 19 | ?> |
|---|
| 20 | :code] |
|---|
| 21 | |
|---|
| 22 | and some C code |
|---|
| 23 | [code:C |
|---|
| 24 | #include <stdio.h> |
|---|
| 25 | #include <stdlib.h> |
|---|
| 26 | #include <string.h> |
|---|
| 27 | |
|---|
| 28 | int main(int argc, char *argv[]) { |
|---|
| 29 | return(0); |
|---|
| 30 | } |
|---|
| 31 | :code] |
|---|
| 32 | That's it for today |
|---|
| 33 | |
|---|
| 34 | </example> |
|---|
| 35 | |
|---|
| 36 | We use the GeShI php classes for the syntax highlighting. |
|---|
| 37 | This means we support the following languages/syntaxes: |
|---|
| 38 | abap, actionscript, ada, apache, applescript, asm, asp, |
|---|
| 39 | autoit, bash, blitzbasic, bnf, caddcl, cadlisp, cfdg, cfm, |
|---|
| 40 | c_mac, c, ,cpp, cpp-qt, csharp, css, delphi, diff, div, |
|---|
| 41 | dos, dot, d, eiffel, fortran, freebasic, genero, gml, |
|---|
| 42 | groovy, haskell, html4strict, idl, ini, inno, io, java5, |
|---|
| 43 | java, javascript, latex, lisp, lua, m68k, matlab, mirc, |
|---|
| 44 | mpasm, mysql, nsis, objc, ocaml-brief, ocaml, oobas, oracle8, |
|---|
| 45 | pascal, perl, per, php-brief, php, plsql, python, qbasic, rails, |
|---|
| 46 | reg, robots, ruby, sas, scheme, sdlbasic, smalltalk, smarty, |
|---|
| 47 | sql, tcl, text, thinbasic, tsql, vbnet, vb, vhdl, visualfoxpro, |
|---|
| 48 | winbatch, xml, xpp, z80 |
|---|
| 49 | |
|---|
| 50 | Bugs etc can be posted on http://dev.mvblog.org |
|---|