The following is a lump of code I use to fontify source code on my site, http://rtfm.etla.org/ (which was the reason, incidentally, that Htmlfontify was written in the first place).
(defvar rtfm-section nil) ;; Constructs an appropriate header string to fit in with rtfm's ;; templating system, based on the file and the stylesheet string (defun rtfm-build-page-header (file style) (format "#define TEMPLATE red+black.html #define DEBUG 1 #include <build/menu-dirlist|>\n html-css-url := /css/red+black.css title := rtfm.etla.org ( %s / src/%s ) bodytag := head <=STYLESHEET;\n %s STYLESHEET main-title := rtfm / %s / src/%s\n main-content <=MAIN_CONTENT;\n" rtfm-section file style rtfm-section file)) ;; the footer: (defun rtfm-build-page-footer (file) "\nMAIN_CONTENT\n") (defun rtfm-fontify-buffer (section) (interactive "s section[eg- emacs / p4-blame]: ") (require 'htmlfontify) (let ((hfy-page-header 'rtfm-build-page-header) (hfy-page-footer 'rtfm-build-page-footer) (rtfm-section section)) (htmlfontify-buffer) ) ) ;; Here's the function I actually call---it asks me for a section label, ;; and source and destination directories, and then binds a couple of ;; customization variable in a let before calling htmlfontify: (defun rtfm-build-source-docs (section srcdir destdir) (interactive "s section[eg- emacs / p4-blame]:\nD source-dir: \nD output-dir: ") (require 'htmlfontify) (hfy-load-tags-cache srcdir) (let ((hfy-page-header 'rtfm-build-page-header) (hfy-page-footer 'rtfm-build-page-footer) (rtfm-section section) (hfy-index-file "index") (auto-mode-alist (append auto-mode-alist '(("dbi\\(shell\\|gtk\\)$" . cperl-mode) ("\\.xpm$" . c-mode )))) ) (htmlfontify-run-etags srcdir) (htmlfontify-copy-and-link-dir srcdir destdir ".src" ".html")))