rtfm / Emacs / htmlfontify


htmlfontify is a bit of elisp I threw together to convert a (fontified) emacs buffer into display-equivalent html. Once I got that far, I just sort of got carried away and modified it to be able to html-ise and cross link a source tree using etags ( or exuberant-ctags ) - It wasn't actually that hard - the only vaguely tricky bits being getting font-property inheritance right ( some properties override, some accumulate - I probably haven't got it quite right, but it seems to do the right thing, mostly ) and preventing the etags hyperlinks from stomping all over one another or overlapping ( eg when a tag happened to be a substring of another tag ). Anyway:


htmlfontify is developed under debian's emacs21, although I occasionally test it under emacs20. I don't know if it works under xemacs21 - I suspect that it might not, since xemacs uses slightly different function names to emacs in places. It shouldn't be too hard to work around this, though, if anyone is interested in working on it. ( You could always compare htmlize.el to see what the differences are ).


As far as I know, htmlfontify meets the emacs lisp coding standards.

The html it produces should also be fully compliant - I run this whole site through nsgmls, and typically the only errors it finds are the odd ^L (\x12) or BS (\x127) character embedded in a string constant somewhere. ( While these are technically errors, I'm not sure how to fix them while maintaining code->htmlfontify->browser-cut-n-paste->code invariance. )

That said, I do occasionally find errors in the html, usually when a tag spans a particularly busy section with lots of different fonts - If you have code which htmlfontify trips up on, please let me know, and I'll try to fix it.

Examples and Source

Valid HTML 4.01! Valid CSS! Any Browser Debian Pepperfish