NAME
IO::Factotum::sourcehighlight - syntax highlight by GNU Source-highlight
SYNOPSIS
perl -MIO::Factotum::sourcehighlight -ne 'print' file.c
ansicolumn --factotum=sourcehighlight file.c file.h
DESCRIPTION
This module registers a converter of IO::Factotum which colors source files by the source-highlight command of GNU Source-highlight, the one often used with less through LESSOPEN:
source-highlight --failsafe --infer-lang -f esc \
--style-file=esc.style -i FILE
The language is told by source-highlight from the name of the file, and that of a script from its first line. A file whose language is not known is read as it is, and so are a file which has an escape character already, an empty file, and a file larger than $IO::Factotum::sourcehighlight::MAX_SIZE bytes (256 KB by default, 0 for no limit).
The colors are those of esc.style, which comes with source-highlight. Set @IO::Factotum::sourcehighlight::STYLE to use another style file:
@IO::Factotum::sourcehighlight::STYLE = ('--style-file=my.style');
Loaded by use or -M, it also ties ARGV (IO::Factotum::tie_argv), and a program which reads by <> gets the colored text. setup only registers the converter.
INSTALL
source-highlight is in Homebrew and in the packages of the Linux distributions:
brew install source-highlight