4 ms·
Ask HN: Do you have a good source code to HTML solution?
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.
What do you use to turn source code into HTML?
- fendrak 17y agoMy software engineering professor always used Code2HTML for the code samples he posted online: http://www.palfrader.org/code2html/ http://www.palfrader.org/code2html/ While I never used it myself, it produced nicely formatted results.
- NathanKP 17y agoThanks for the suggestion. Sadly it doesn't handle PHP though.
- brianto2010 17y agoI've never had to do that (ever), but... Vim: :TOhtml Notepad++: Plugins > NppExport > Export to HTML
- NathanKP 17y agoDoes that actually add markup to colorize the code or does it just wrap it in <pre> tags?
- brianto2010 17y agoQuick 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/ 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 17y agoThanks a lot!
- awa 17y agohttp://www.stanleyshilov.com/online-tools/convert-special-characters-into-html-entities/ http://www.stanleyshilov.com/online-tools/convert-special-ch... in combination with Syntax highlighter http://code.google.com/p/syntaxhighlighter/ http://code.google.com/p/syntaxhighlighter/