|
C++2HTML
|
||
|
Personal
Research
Free source codes
|
Convert C++ code to syntax highlighted (colored) HTML
How does it work?
Paste your C++ code into the box below and
press the Convert button. The output will open in a new window.
If desired, you can save the output from the browser menu in
the output window. Choose to save as HTML only.
Should I generate XHTML 1.1?
Generally, yes, because it is very likely that pages that are written in XHTML 1.1 will
stay compatible with future browsers for very long. For more details about the
XHTML standard and why it is so important you can visit http://www.w3.org/.
Although XHTML is quite modern, the pages that are generated by C++2HTML are compatible
with very old browsers like Netscape 4 and Internet Explorer 4! Only if you need to
develop pages that are compatible with version 3 or even older browsers, you should generate the
old HTML pages.
Can I modify the colors?
Yes, very easily! If you only want to change the colors for one generated page, just
open that page in a text editor and look for the following lines:
.comment { color: #999999; font-style: italic; }
.pre { color: #000099; }
.string { color: #009900; }
.char { color: #009900; }
.float { color: #996600; }
.int { color: #999900; }
.bool { color: #000000; font-weight: bold; }
.type { color: #FF6633; }
.flow { color: #FF0000; }
.keyword { color: #990000; }
.operator { color: #663300; font-weight: bold; }
Here you can edit the colors. It is pretty self-explaining I hope.
It is also possible to change the default colors because the program is written in
client-side JavaScript.
Save this page and open it in a text editor. Look for the following lines:
comment = {color:"#999999", bold:false, italic:true, name:"comment"} precompiler = {color:"#000099", bold:false, italic:false, name:"pre"} operator = {color:"#663300", bold:true, italic:false, name:"operator"} stringLiteral = {color:"#009900", bold:false, italic:false, name:"string"} charLiteral = {color:"#009900", bold:false, italic:false, name:"char"} intLiteral = {color:"#999900", bold:false, italic:false, name:"int"} floatLiteral = {color:"#996600", bold:false, italic:false, name:"float"} boolLiteral = {color:"#000000", bold:true, italic:false, name:"bool"} types = {color:"#FF6633", bold:false, italic:false, name:"type"} flowControl = {color:"#FF0000", bold:false, italic:false, name:"flow"} keyword = {color:"#990000", bold:false, italic:false, name:"keyword"}Now you can edit the colors and set which elements must be displayed bold and/or italic. Save the page, and you can run your modified version by opening it in your browser! Does it work offline?
Yes, if this page is loaded in your browser and you go offline,
the script will still work because it is client-side JavaScript, and
nothing needs to be uploaded or downloaded. Of course,
if you are not online very often, you can save this page to your harddisk and
work with it offline.
|
|