Just add some definitions to your site's css style sheet:
/* ...*/
/******************** LISP Attributes ********************/
.function {
font-weight: bold;
color: yellow;
}
.command {
font-weight: bold;
color: yellow;
}
.call {
color: #ff6633;
}
.comment1 {
color: #00ff00;
}
.comment2 {
color: #ff66ff;
}
.copyright {
color: #4080ff;
}
.result {
color: #5090ff;
}
.notes {
color: #ffff80;
}
.error {
font-weight: bold;
color: #ff0000;
}
.data {
color: #66ffff;
}
.alert {
font-weight: bold;
color: #00ffff;
}
/******************** pre definition ********************/
#content pre {
background: #202020;
font-size: 12px;
color: #e0e0e0;
margin: 5px 5px 10px 5px;
padding: 5px 5px 5px 10px;
border: 1px solid #DDDDDD;
font-family: Consolas, "lucida console", "courier new", monospace;
}
/* ... */
Take some code:
(defun _ToBase64 ( text )
;; Copyright (c) 2008 Michael Puckett All rights reserved.
;; For terms of use see http://XXXXXXXXXX.com/terms-of-use
(if (/= "" text)
( (lambda ( codes map / _MaskThenShift _Map len result )
(defun _MaskThenShift ( int mask shift )
(lsh (logand int mask) shift)
)
(defun _Map ( key ) (nth key map))
(while (< 2 (setq len (length codes)))
(setq result
(append result
(mapcar '_Map
(list
(_MaskThenShift (car codes) 252 -2)
(logior
(_MaskThenShift (car codes) 3 4)
(_MaskThenShift (cadr codes) 240 -4)
)
(logior
(_MaskThenShift (cadr codes) 15 2)
(_MaskThenShift (caddr codes) 192 -6)
)
(logand (caddr codes) 63)
)
)
)
codes (cdddr codes)
)
)
(vl-list->string
(if (null codes) result
(append result
(mapcar '_Map
(if (eq 1 len)
(list
(_MaskThenShift (car codes) 252 -2)
(_MaskThenShift (car codes) 3 4)
)
(list
(_MaskThenShift (car codes) 252 -2)
(logior
(_MaskThenShift (car codes) 3 4)
(_MaskThenShift (cadr codes) 240 -4)
)
(_MaskThenShift (cadr codes) 15 2)
)
)
)
)
)
)
)
(vl-string->list text)
(_Base64Map) ;; external call
)
""
)
)
Format it accordingly for html posting (I have a proggy I'm working on (not public yet) that does it for me):
<pre>(defun <span class="function">_ToBase64</span> ( text )
<span class="comment1">;; Copyright (c) 2008 Michael Puckett All rights reserved.
;; For terms of use see http://XXXXXXXXXX.com/terms-of-use</span>
(if (/= "" text)
( (lambda ( codes map / _MaskThenShift _Map len result )
(defun <span class="function">_MaskThenShift</span> ( int mask shift )
(lsh (logand int mask) shift)
)
(defun <span class="function">_Map</span> ( key ) (nth key map))
(while (< 2 (setq len (length codes)))
(setq result
(append result
(mapcar '<span class="call">_Map</span>
(list
(<span class="call">_MaskThenShift</span> (car codes) 252 -2)
(logior
(<span class="call">_MaskThenShift</span> (car codes) 3 4)
(<span class="call">_MaskThenShift</span> (cadr codes) 240 -4)
)
(logior
(<span class="call">_MaskThenShift</span> (cadr codes) 15 2)
(<span class="call">_MaskThenShift</span> (caddr codes) 192 -6)
)
(logand (caddr codes) 63)
)
)
)
codes (cdddr codes)
)
)
(vl-list->string
(if (null codes) result
(append result
(mapcar '<span class="call">_Map</span>
(if (eq 1 len)
(list
(<span class="call">_MaskThenShift</span> (car codes) 252 -2)
(<span class="call">_MaskThenShift</span> (car codes) 3 4)
)
(list
(<span class="call">_MaskThenShift</span> (car codes) 252 -2)
(logior
(<span class="call">_MaskThenShift</span> (car codes) 3 4)
(<span class="call">_MaskThenShift</span> (cadr codes) 240 -4)
)
(<span class="call">_MaskThenShift</span> (cadr codes) 15 2)
)
)
)
)
)
)
)
(vl-string->list text)
(<span class="call">_Base64Map</span>) <span class="comment2">;; external call</span>
)
""
)
)</pre>
Voila (sorry for the ugly grab: the swamp is resizing the image, here's the crispy original:
http://i56.tinypic.com/35ls1th.jpg):
My bent on highlighting is I only want to see 2 variations of comments, function definitions, calls, errors, data and output. Adding colors for all functions, strings etc. just gets too garish for me and detracts from what I want to achieve: clarity showing what I've done.
An aside, many folks use a syntax highlighter by Alex Gorbatchev. Search the net, there's many adaptions, e.g. for wordpress etc. All you have to do is tweak it for lisp. I didn't go that route because I had specific wants not available with his plug-in.