by Lorenzo Bettini
This program, given a source file, produces a document with syntax highlighting. It also provides a C++ highlight library (new) (since version 3.0).
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).
Source-highlight is a command line program, and it can also be used as a CGI.
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, <, >, &).
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:
These are the input languages (or input formats) already
(in alphabetical order):
NOTICE: now the name of the program is source-highlight: there are no two separate programs, namely java2html and cpp2html, anymore. However there are two shell scripts with the same name in order to facilitate the migration (however their use is not advised).
GNU Source-highlight is free software. Please see the file COPYING for details. For documentation, please read this file.
GNU Source-highlight is a GNU
program and its main home page is at GNU site:
If you want to use source-highlight library inside your C++ programs, you may want to read the manual of the library and the API documentation.
I do not distribute Windows binaries anymore; since, they can be built
by using Cygnus C/C++ compiler, available at
http://www.cygwin.com. However, if you don't feel like
downloading such compiler or you experience problems with the Boost
Regex library (please also keep in mind that if you don't have these libraries
installed, and your C/C++ compiler distribution does not provide a
prebuilt package, it might take some time, even hours, to build the
Boost libraries from sources), you can request such binaries directly to
me, by e-mail (find my e-mail at my home page) and I'll be happy to send
them to you. An MS-Windows port of Source-highlight is available from
http://gnuwin32.sourceforge.net; however, I don't maintain those
binaries personally, and they might be out of date.
Language definition files and output language definition files, which are part of source-highlight distribution, can also be downloaded independently from, respectively:
However, note that the files you find at the above urls are tested with the latest version of source-highlight (thus, e.g., they may require features that are not present in an earlier version of source-highlight);
git clone git://git.savannah.gnu.org/src-highlite.git
Further instructions can be found at the address:
And the git repository can also browsed on-line at http://git.savannah.gnu.org/cgit/src-highlite.git.
NOTE: Since version 3.1.2 of Source-highlight the CVS repository was dismissed in favor of Git (http://git-scm.com/).
Please notice that this way you will get the latest development sources of Source-highlight, which may also be unstable. This solution is the best if you intend to correct/extend this program: you should send me patches against the latest git repository sources.
If, on the contrary, you want to get the sources of a given release, through git, say, e.g., version X.Y.Z, you must specify the git tag rel_X_Y_Z.
When you compile the sources that you get from the git repository, before running the configure and make commands, you must run the command:
This will run the autotools commands in the correct order, and also copy possibly missing files. You should have installed recent versions of automake, autoconf and libtool in order for this to succeed.
We strongly suggest to use shadow builds, thus, create a build directory, say build and run configuration and make in that directory. To summarize, the steps to get the sources from git and make the first build are:
git clone git://git.savannah.gnu.org/src-highlite.git cd src-highlite autoreconf -i mkdir build cd build ../configure make
Here we list some software related to source-highlight in the sense that it uses it as a backend (i.e., provides an interface to source-highlight) or it uses some of its features (e.g., definition files):
Actually I want to extend it, so if you have some ideas...
The most import one will be to make source-highlight more powerful :-)
Please send all bug reports by electronic mail to:
bug-source-highlight at gnu dot org
Or, even better, use
My home page is http://www.lorenzobettini.it
source-highlight is free software. See the file COPYING for copying conditions. Anyway I won't get offended if you send me a postcard :-)
Return to GNU's home page.
Please send FSF & GNU inquiries & questions to email@example.com. There are also other ways to contact the FSF.
Please send comments on these web pages to firstname.lastname@example.org, send other questions to email@example.com.
Copyright (C) 2001 Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA
Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.
Updated:9 Jan 2001 mhw