Monday, October 09, 2006

GNU Source-highlight 2.5

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.

These are the output formats already supported:
  • HTML
  • XHTML
  • LATEX
  • TEXINFO
  • ANSI color escape sequences (you can use this feature with less)
  • DocBook
These are the input languages (or input formats) already supported (in alphabetical order): C/C++, C#, Bib, Bison, Caml, Changelog, Diff, Flex, Fortran, Html, Java, Javascript, Latex, Logtalk, Log files, Lua, ML, Pascal, Perl, PHP, Postscript, Prolog, Python, Ruby, Shell, Sql, Tcl, XML.

Happy Highlighting! :-)

2 comments:

Sandeep said...

Thanks, i was looking for this kind of program to insert source code into my presentations

betto said...

glad to hear that :)

you mean LaTeX presentations?