My last post included some source code, and I really struggled how to make this look readable.
I use NetBeans, and I checked, and sure enough, there is an option to export a source file or a selection of source to HTML ("File->Print to HTML..." in NetBeans 6).
This takes care of all those nasty less-than / greater-than conversions. It also sets up some styles and applies those styles to the code, so you get readable code through color-coding.
The trick is, NetBeans generates this as a complete HTML page. But I want to embed this in an existing page. This worked generally, but the styles were lost.
After some thought, what I did was edit the HTML for my template, and then added the styles at the top of the NetBeans generated page to the styles for the template. And voila, I have nice, color-coded source code that is a simple cut-and-paste from NetBeans.
No comments:
Post a Comment