Sunday, April 19, 2009

Htmlize latest version

Just so you know, the latest version of htmlize.el seems to be in the contrib directory of org-mode git repository. Of course, you can also download it from here, the author's site.

For an explanation of what htmlize is, see the emacswiki page. or if you go to the author's site, you will see this file, which is the generated HTML output of his emacs buffer as he sees htmlize.el! Htmlize is able to generate the appropriate html colour codes so that the generated output matches the way you have set up font locking in your Emacs buffer!

The simplest way to understand how htmlize works is to
  1. Download htmlize and load it
  2. Open an existing text file or some code file like a C/C++ program
  3. M-x Htmlize-buffer
  4. Save the generated .html file
  5. Open it using the browser
It would also help to read the documentation commentary in the elisp code.

I've used it many times to show my co-workers my code, instead of just sending the actual code file. You see, their editors (which are definitely not Emacs) does not do syntax highlighting like the way I'm used to or does not have syntax highlighting at all. With this, I have a portable html file and still have the font locking that I want while I'm explaining my brain dead code to them.