I just discovered Java2Html.
There are many code highlighters that let you take code snippets
and include them in HTML pages while preserving their colors, but they all
suffer from two problems:
- They are Web-based (you need to copy/paste your code to the form,
submit, get the result back and paste it in your HTML file). - They are CSS-based, which forces your HTML page to include that CSS file
as well.
Interestingly, this is one of the rare cases where separating style and
content, as enabled by CSS, is an annoyance.
Java2Html solves these two problems by:
- Providing an Eclipse plug-in (and also a standalone Swing application if
you prefer), therefore allowing you to do everything from Eclipse. - Embedding font information directly in the HTML generated (no CSS), so
that it’s really a matter of copy/pasting the code as it is into your HTML
pages (and Java2Html lets you either put the generated code in the clipboard
or in a file).
Simple and effective.