

Ask HN: Do you have a good source code to HTML solution? - NathanKP

A while back one of HN's members posted about a great online tool that he had created for converting code snippets of just about any language into colorized HTML.  Despite my best searching I can not find it again, and searches of the internet in general all return source code colorizers that have some form of drawback to them.<p>What do you use to turn source code into HTML?
======
fendrak
My software engineering professor always used Code2HTML for the code samples
he posted online:

<http://www.palfrader.org/code2html/>

While I never used it myself, it produced nicely formatted results.

~~~
NathanKP
Thanks for the suggestion. Sadly it doesn't handle PHP though.

------
awa
[http://www.stanleyshilov.com/online-tools/convert-special-
ch...](http://www.stanleyshilov.com/online-tools/convert-special-characters-
into-html-entities/) in combination with Syntax highlighter
<http://code.google.com/p/syntaxhighlighter/>

------
brianto2010
I've never had to do that (ever), but...

Vim:

    
    
      :TOhtml
    

Notepad++:

    
    
      Plugins > NppExport > Export to HTML

~~~
NathanKP
Does that actually add markup to colorize the code or does it just wrap it in
<pre> tags?

~~~
brianto2010
Quick answer: no. It generates the actual HTML based on your current color
scheme and font. Notepad++ is the same (I think).

Long answer: Check this link:

<http://code.google.com/p/vimcolorschemetest/>

At the bottom, click on one of the provided languages. This will give you a
preview of what the command actually outputs. The page itself states, "To
generated these pages, I used the TOhtml command in the Vim 7.2 distribution
to generate the html files inside the iframes". Just note, the font won't be
as disgusting when you actually do the conversion.

~~~
NathanKP
Thanks a lot!

