For my PyMOTW series, I have found that I want to convert a lot of python source code to HTML. In a perfect world it would be easy for me to produce pretty XML/HTML and use CSS, but it is not obvious how to use CSS from Blogger. Instead, I am using a CLI app based on this ASPN recipe which produces HTML snippets that I can paste directly into a new blog post. The output HTML is more verbose than I wanted, but I like the fact that it has no external dependencies.
If you have any alternatives, I would appreciate hearing about them.
4 comments:
I've used pygments for converting converting source code to colorized LaTeX: http://pygments.org/
It does HTML output as well, though I have never tried it myself.
Heh. I clicked through just to recommend Pygments, only to find somebody had already done it! Yes, Pygments is a very handly library, and it can handle way more than Python.
Pygments looks pretty good, especially considering the Web UI means I don't have to install anything myself. I've just thrown up a test post as an example to see what sort of feedback I receive.
Thanks for the recommendation!
A bit late comment, but anyway.
If you use(or plan to use) Emacs you may take a look at htmlize package. It's usage i've described in my blog
Post a Comment