WP-Syntax Usage

I’m currently using Version 0.9.8 of WP-Syntax. I thought I would quickly go over its usage. To use WP-Syntax just switch over to HTML mode from Visual mode. The reason you need to do this is because Visual mode will escape out our <pre> code. Also, if your code contains any &, <, or >, you will need to stay in HTML mode for the rest of the post, otherwise if you switch back to Visual mode, some of your code could get double escaped and not work. (i.e. &amp;, &lt;, or &gt;). It might be easiest to write your post and add the code at the end.

There are 3 main options.

First, you have starting line number.

<pre lang=”php” line=”5″>
echo “test”;
</pre>

that would produce something like:

echo "test";

Second, you can specify whether the text is already escaped or not

<pre lang=”php” escaped=”true”>
&lt;?php
echo &quot;Hello&quot;;
?&gt;
</pre>

Would produce:

<?php
echo "Hello";
?>

Lastly, and most important you have the lang attribute. This attribute tells WP-Syntax what language and syntax to use for highlighting code. It uses GeSHi – Generic Syntax Highlighter behind the scenes. I did a quick search for a list of what languages WP-Syntax supports and their respective lang attributes, but was unable to find one. So I compiled one and here it is.

The following languages are supported in the “lang” attribute:

#syntab { border: 1px solid #C0C0C0; padding: 0px; margin: 0px; border-collapse: collapse; }
#syntab td, #syntab th{ border-bottom: 1px solid #C0C0C0; padding: 5px; }

Language lang=
ABAP abap
abas-ERP fo
Actionscript actionscript
Actionscript 3 actionscript3
ADA ada
Apache Log apache
AppleScript applescript
APT sources.list apt_sources
ASM (m68k) m68k
ASM (pic16) pic16
ASM (x86) asm
ASM (z80) z80
ASP asp
AutoIT autoit
AviSynth avisynth
Backus-Naur form bnf
Bash bash
Basic4GL basic4gl
BibTex bibtex
BlitzBasic blitzbasic
Boo boo
Brainfuck bf
C c
C for Macs c_mac
C# csharp
C++ cpp
C++ (with QT) cpp-qt
CAD DCL caddcl
CadLisp cadlisp
CFDG cfdg
CIL / MSIL cil
Cmake cmake
COBOL cobol
ColdFusion cfm
CSS css
D d
DCS (Data Conversion System) dcs
Delphi delphi
Diff File Format diff
DIV div
DOS dos
DOT language dot
Eiffel eiffel
Email (mbox \ eml \ RFC format) email
Erlang erlang
Formula language lotusformulas
Fortran fortran
FourJ’s Genero genero
FreeBasic freebasic
GetText gettext
glSlang glsl
GML gml
gnuplot gnuplot
Groovy groovy
Haskell haskell
HQ9+ hq9plus
HTML html4strict
INI (Config Files) ini
Inno inno
INTERCAL intercal
IO io
Java java
Java 5 java5
Javascript javascript
KiXtart kixtart
KLone C klonec
KLone C++ klonecpp
LaTeX latex
Linden Scripting lsl2
Lisp lisp
Locomotive Basic locobasic
LOLcode lolcode
LotusScript lotusscript
LScript lscript
Lua lua
Make make
MATLAB matlab
Microchip Assembler mpasm
mIRC mirc
Modula-3 modula3
MXML mxml
MySQL mysql
NSIS nsis
Oberon-2 oberon2
Objective C objc
OCaml ocaml
OCaml (Objective Caml) (Brief) ocaml-brief
OpenOffice BASIC oobas
Oracle 8 SQL oracle8
Oracle 11 SQL oracle11
Pascal pascal
Per (forms) (FOURJ’s Genero 4GL) per
Perl perl
PHP php
PHP (Brief) php-brief
Pixel Bender pixelbender
PL/SQL plsql
Plain Text text
POV-Ray povray
PowerShell powershell
Progress (OpenEdge ABL) progress
Prolog prolog
Property properties
ProvideX providex
Python python
Q(uick)BASIC qbasic
Rebol rebol
robots.txt robots
Ruby ruby
Ruby on Rails rails
SAS sas
Scala scala
Scheme scheme
Scilab scilab
SDLBasic sdlbasic
Smalltalk smalltalk
Smarty smarty
SQL sql
T-SQL tsql
TCL tcl
Tera Term Macro teraterm
thinBasic thinbasic
TypoScript typoscript
Uno IDL idl
VB.NET vbnet
Verilog verilog
VHDL vhdl
VIM Script vim
Visual BASIC vb
Visual Fox Pro visualfoxpro
Visual Prolog visualprolog
Whitespace whitespace
Winbatch winbatch
Windows Registry Files reg
Whois response (RPSL format) whois
X++ xpp
XML xml
Xorg.conf xorg_conf