GNU Source-highlight
by Lorenzo Bettini <http://www.lorenzobettini.it>
This program, given a source file, produces a document with syntax
highlighting.
The home page is http://www.gnu.org/software/src-highlite/
You can download it from GNU's ftp site:
ftp://ftp.gnu.org/gnu/src-highlite/ or from one of its mirrors (see
http://www.gnu.org/prep/ftp.html).
This project's git repository can be checked out through
the following clone instruction:
git clone git://git.savannah.gnu.org/src-highlite.git
Further instructions can be found at the address:
http://savannah.gnu.org/projects/src-highlite.
Installation
Since version 2.0 Source-highlight relies on regular expressions as
provided by boost, http://www.boost.org, so you need to install at
least the regex library from boost. Most GNU/Linux distributions
provide this library already in a compiled form.
See the file INSTALL for detailed building and installation
instructions; anyway if you're used to compiling Linux software that
comes with sources you may simply follow the usual procedure:
cd <source code main directory>
./configure
make
make install
Note: unless you specify a different install directory by --prefix
option of configure (e.g. ./configure --prefix=/<your home>/), you must
be root to 'make install'.
It is also possible to specify as following option for
configure: --enable-input-chroot to hardcode in the program the path
to prefix for input files.
Before you run 'make install' you may want to check that the programs
have compiled fine, so you can run 'make check'.
Files will be installed in the following directories:
Executables
prefix/bin
docs and output examples
prefix/share/doc/source-highlight
library examples
prefix/share/doc/source-highlight/examples
library API documentation
prefix/share/doc/source-highlight/api
conf files
prefix/share/source-highlight
Default value for prefix is /usr/local but you may change it with
--prefix option to configure (see above).
You can also build source-highlight using qmake.
For further information, please look at the section
"Building with qmake" in the manual.
Building .rpm
Christian W. Zuckschwerdt added support for building an .rpm and an
.rpm.src. You can issue the following command
rpm -tb source-highlight-1.9rc.tar.gz
for building an .rpm with binaries and
rpm -ts source-highlight-1.9rc.tar.gz
for building an .rpm.src with sources.
Patching from a previous version
If you downloaded a patch, say source-highlight-1.3-1.3.1-patch.gz(i.e.
the patch to go from version 1.3 to version 1.3.1), cd to the directory
with sources from the previous version (source-highlight-1.3) and type:
gunzip -cd ../source-highlight-1.3-1.3.1.patch.gz | patch -p1
and restart the compilation process (if you had already run configure a
simple make will do).
Usage and examples
See the index.html in the doc directory for many examples.
Use source-highlight with less
This was suggested by Konstantine Serebriany.
The script src-hilite-lesspipe.sh will be installed together with
source-highlight.
You can use the following environment variables:
export LESSOPEN="| /path/to/src-hilite-lesspipe.sh %s"
export LESS=' -R '
This way, when you use less to browse a file, if it is a source file
handled by source-highlight, it will be automatically highlighted.
Credits
See CREDITS for detailed contributions and THANKS for a complete list
of people that helped me with Source-highlight :-)
Feedback
Please tell me if you like this software :-)
Actually I want to extend it, so if you have some ideas...
The most import one will be to make source-highlight more customizable :-)
Please send all bug reports by electronic mail to:
bug-source-highlight at gnu.org
TODO
Here's the list of TODO stuff <TODO.txt>, if you'd like to contribute :-)
Mailing Lists
The following mailing lists are available:
* help-source-highlight at gnu.org
for generic discussions
about the program and for asking for help about it (open mailing
list), http://mail.gnu.org/mailman/listinfo/help-source-highlight
* info-source-highlight at gnu.org
for receiving information
about new releases and features (read-only mailing list),
http://mail.gnu.org/mailman/listinfo/info-source-highlight
if you want to subscribe to a mailing list just go to the URL and follow
the instructions, or send me an e-mail and I'll subscribe you.
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 :-)