View Full Version : Code to HTML

03-13-2005, 01:06 AM
Is there a standard way to convert cpp code to HTML (for the purpose of publishing code samples on a website)? I am hoping there is a way to preserve the text coloring used in visual studio. Thanks.

03-13-2005, 01:46 AM
I dont know what compiler you are using but I can do it in dev-c++

03-13-2005, 11:55 AM
I'm using Visual Studio.Net...it's surprising that the option is not available (or at least I couldn't find it). Any other ideas?

03-13-2005, 11:59 AM
Download a copy of Dev-CPP and use it's export feature ;)

03-13-2005, 12:10 PM
Perhaps this page is something for you?

03-14-2005, 12:22 AM
Highlight 2.2 (http://www.andre-simon.de/) is a nice utility that will convert your code into colored output in HTML, XHTML, RTF, TeX, LaTeX, XSL-FO and XML format.

03-14-2005, 02:19 AM
I used to use this - http://www.sunlightd.com/Projects/CPPtoHTML/

03-14-2005, 10:43 AM
i wrote my own little program to do this, pretty easy to do

03-14-2005, 11:49 AM
As I was reading these posts, I was thinking of writing a program to do it...not because it's needed, but it just sounds kind of fun.

I was thinking of using the output of the www.rafb.net page as a starting place on what the HTML should look like.

BTW, thanks everyone for the info.

03-14-2005, 11:57 AM
I just use the <pre> tag

03-14-2005, 12:49 PM
I just use the <pre> tagthat won't hold up colors or anything...

I use this program (http://www.codeguru.com/Cpp/misc/samples/codehighlighting/article.php/c4693) for HTML and vB exporting of my C/C++ code. It's also capable of Visual Basic code, and since it's open source, you can learn alot from it.

03-15-2005, 03:00 AM
I just finished my own version. Yes...the <pre> tag was useful.