Here’s a method for embedding code in an HTML page using a quick and painless tool called code2html. code2html is available in most distribution repositories, so installing it is just a matter of calling your package manager like
yum install code2html. After installing it, here’s an example of how to use it:
code2html -l plain -o html-nocolor myprogram.c > myprogram.c.html
cat myprogram.c | code2html -l plain -o html-nocolor - > myprogram.c.html
When finished, you can then copy/paste the contents into another webpage. In my example, I chose to have a plain conversion and no colors so that I can use the
<pre> tag to make my output look like I want it to.
Be sure to check out the code2html man page for plenty of other examples and usage information.