I've recently released the new version of GNU Source-highlight, http://www.gnu.org/software/src-highlite, which, given a source file, produces a document with syntax highlighting.
Source-highlight reads source language specifications
dynamically, thus it can be easily extended (without recompiling
the sources) for handling new languages.
It also reads output format specifications dynamically, and
thus it can be easily extended (without recompiling
the sources) for handling new output formats.
The syntax for these specifications is quite easy (take a look at the manual).
This way, instead of the colorless listings such as
/*
A simple hello program,
for http://tronprog.blogspot.com
*/
#include <iostream>
using namespace std;
int main()
{
cout << "Hello Blog!\n" << endl;
return 0;
}
You'll get the more nice looking one:
/*
A simple hello program,
for http://tronprog.blogspot.com
*/
#include <iostream>
using namespace std;
int main()
{
cout << "Hello Blog!\n" << endl;
return 0;
}
Notice that source-highlight can also be used as a formatter (i.e.,
without highlighting): you can, for instance, format a txt file in HTML (and it will take care of translating special characters, such as, <, >, &). In particular, the first (non colored) listing in this article was formatted with source-highlight without any highlighting but with the transformation of special characters.
Since version 2.2, source-highlight can also generate cross references; in order to do this it relies on
GNU Ctags, http://ctags.sourceforge.net.
- HTML
- XHTML
- LATEX
- TEXINFO
- ANSI color escape sequences (you can use this feature with less)
- DocBook
Happy Highlighting! :-)
2 comments:
Thanks, i was looking for this kind of program to insert source code into my presentations
glad to hear that :)
you mean LaTeX presentations?
Post a Comment