Man Linux: Main Page and Category List


       Highlight - a universal sourcecode to formatted text converter


       highlight [OPTIONS]... [FILES]...


       Highlight  converts  sourcecode  to  HTML, XHTML, RTF, LaTeX, TeX, XML,
       BBCode, SVG, XTERM or ANSI  escape  sequences.   There  are  40  colour
       themes  available.   Highlight  recognizes  keywords, numbers, strings,
       comments, symbols and preprocessor  directives.   It  supports  ABAP/4,
       Abstract,  Action  Script,  ADA95,  Agda,  AMPL, AMTrix, Apache Config,
       AppleScript, Applied Type System, Arc,  ARM,  ASCEND,  ASP,  Assembler,
       AutoIt,  Avenue, Bash, BibTeX, Bison, Blitz Basic, BM Script, C#, C and
       C++, ClearBasic, Clipper, Clips, Clojure, COBOL, ColdFusion MX, CSS, D,
       Diff, DOS Batch, Dylan, Eiffel, Erlang, Euphoria, Express, FAME, Felix,
       Fortran 77, Fortran 90, Frink, (G)AWK, Graphviz, Haskell, Haskell  LHS,
       Hecl,  Icon, IDL, Informix, INI, Interactive Data Language, IO, Jasmin,
       Java, Javascript, JSP, LDAP, Lilypond, Linden  Script,  Lisp,  Logtalk,
       Lotos,  Lotus,  Lua,  Luban,  Make,  Maple,  Matlab,  MaxScript,  Maya,
       Mercury,  Microsoft  PowerShell,  Miranda,  Modelica,  Modula3,  MSSQL,
       Nasal, Nemerle, Nice, NSIS, Oberon, Objective C, Objective Caml, Object
       Script, Octave, Open Object Rexx, Oz, Paradox,  Pascal,  PATROL,  Perl,
       PHP,  Pike,  PL/1,  PL/SQL,  PostScript,  POV-Ray,  PowerPC  Assembler,
       Progress, Prolog, Pyrex, Python, Python, QMake Project,  Qore,  Qu,  R,
       Rebol,  Relax  NG,  Rexx,  RPM  Spec,  Ruby, SAS, Scala, Scilab, SMALL,
       Smalltalk, SNMP, SNOBOL, SPIN SQL,  Squirrel,  Standard  ML,  SuperX++,
       Sybase  SQL,  Tcl/Tk,  TCSH, TeX and LaTeX, TTCN3, Vala, Verilog, VHDL,
       Visual Basic, XML, Zonnon.

       It’s easily possible to enhance  highlight’s  database  of  programming
       languages and colour themes.  See the README file for details.

General options

       -B, --batch-recursive=<wildcard>
              convert all files matching the wildcard (uses recursive search)

       -D, --data-dir=<path>
              set path to highlight data directory

       -E, --add-data-dir=<path>
              set  path  to  an  additional  data directory, which is searched

              set path to an additional configuration directory

       -h, --help
              print this help

       -i, --input=<file>
              name of input file

       -o, --output=<file>
              name of output file

       -O, --outdir=<output directory>
              name of output directory

       -P, --progress
              print progress bar in batch mode

       -S, --syntax=<type>
              set type of source code, necessary if input filename is unknown

       -v, --verbose
              print debug info to stderr

       -p, --list-langs
              list installed language definitions

       -q, --quiet
              supress progress info in batch mode

       -w, --list-themes
              list installed themes

              generate output if language type is unknown

              print path configuration

              print only style (see --style-outfile)

              ignore listed unknown file types (Example: --skip=’bak;c~;h~’)

              define  nested  language  which  starts  input  without  opening

              test if input is a valid text file

              print version and copyright info

Output formats

       -H, --html
              generate HTML (default)

       -A, --ansi
              generate terminal output (16 colours)

       -L, --latex
              generate LaTeX

       -M, --xterm256
              generate terminal output (256 colours)

       -R, --rtf
              generate RTF

       -T, --tex
              generate TeX

       -X, --xhtml
              generate XHTML 1.1

       -Z, --xml
              generate XML

       -G, --svg
              generate SVG (experimental)

       -Y, --bbcode
              generate BBCode (experimental)

              output file in given format.  <format>: see long options above

Output formatting options

       -c, --style-outfile=<file>
              name  of  style definition file or output to stdout, if "stdout"
              is given as file argument

       -d, --doc-title
              document title

       -e, --style-infile=<file>
              name of file to be included in style-outfile

       -f, --fragment
              omit header and footer of the output document

       -F, --reformat=<style>
              reformat output in given style.  <style>=[allman,  banner,  gnu,
              java, kr, linux, stroustrup, whitesmith]

       -I, --include-style
              include style definition in output

       -J, --line-length=<num>
              line length before wrapping (see -W, -V)

       -j, --line-number-length=<num>
              line number length incl. left padding

       -k, --font=<font>
              set font (specific to output format)

       -K, --font-size=<num?>
              set font size (specific to output format)

       -l, --linenumbers
              print line numbers in output file

       -m, --line-number-start=<cnt>
              start line numbering with cnt (assumes -l)

       -s, --style=<style name>
              set highlighting style (see --list-themes)

       -t  --replace-tabs=<num>
              replace tabs by num spaces

       -u, --encoding=<enc>
              set  output  encoding  which  matches  input file encoding; omit
              encoding information if enc=NONE

       -V, --wrap-simple
              wrap  long  lines  without  indenting  function  parameters  and

       -W, --wrap
              wrap long lines (use with caution)

       -z, --zeroes
              fill leading space of line numbers with zeroes

              output  all  keywords  in  given  case  if  language is not case

              set CR as end-of-line delimiter (MacOS 9)

              omit trailing newline


       -a, --anchors
              attach anchors to line numbers (HTML only)

       -y, --anchor-prefix=<str>
              set anchor name prefix

       -N, --anchor-filename
              use input file name as anchor name

       -C, --print-index
              print index file with links to all output files

              print lines as ordered list items

              set CSS class name prefix print  lines  as  ordered  list  items
              (assumes -l)

              output CSS within each tag (generates verbose output)

       --mark-line=’n[=txt]; m’
              mark given lines n..m and add optional help texts as tooltips

              enclose fragmented output with pre tag (assumes -f)

              read ctags file to include meta information as tooltips (default
              value: tags)


       -b, --babel
              disable Babel package shorthands

       -r, --replace-quotes
              replace double quotes by \dq

              improve appearance of brackets and other symbols


       -x, --page-size=<size>
              set page size, <size>=[a3, a4, a5, b4, b5, b6, letter]

              include character stylesheets


              set image height (units allowed)

              set image size (see --height)


       --doc  create stand alone document

              cancel the --doc option

              the external style sheet filename

              source language

        -t, --tab=INT
              specify tab length

        -n, --line-number[=0]
              number all output lines, optional padding

              number all output lines and generate  an  anchor,  made  of  the
              specified prefix
               p + the line number  (default=’line’)

               output directory

              if  no  language definition is found for the input, it is simply
              copied to the output

       If no in- or output files are specified, stdin and stdout will be  used
       for   in-  or output.  -t will be ignored if -F is set.  -i and -o will
       be ignored if -b or -B is set.  -c will be ignored if the output format
       does not support referenced style files.  HTML will be generated, if no
       other  output  format  is  given.   Style  definitions  are  stored  in
       highlight.css  (HTML,  XHTML,  SVG)  or  highlight.sty  (LaTeX, TeX) if
       neither -c nor -I is given.  Reformatting code will only work  with  C,
       C++, C# and Java input files.


       The  wrapping  options  might  cause  faulty highlighting of multi line


       The parsing information of  the  programming  languages  is  stored  in
       /usr/share/highlight/langDefs/.   You  may  enhance highlights parsing
       capabilities by adding more *.lang - files to this directory.  You  can
       also  define  other  directories  with -D, or add search paths with -E.
       Documentation  files  are   stored   in   /usr/share/doc/highlight/   ,
       configuration files in /etc/highlight/.


       Single file conversion:

       highlight -o hello.html -i hello.c

       highlight -o hello.html hello.c

       highlight -o hello.html -S c < hello.c

       highlight -S c < hello.c > hello.html

       Note that a file highlight.css is created in the current directory.

       Batch file processing:

       highlight -X  -B ’*.cpp’ -O /home/you/html_code/

       converts   all   *.cpp   files   in   the  current  directory  and  its
       subdirectories   to   xhtml   files,   and   stores   the   output   in

       highlight -L  * -O /home/you/latex_code/

       converts all files to LaTeX, stored in /home/you/latex_code/.

       Use   --quiet   to   improve   performance  of  batch  file  processing
       (recommended for usage in shell scripts).

       Use highlight -A <yourfile> | less -R to display a  source  file  in  a


       Andre Simon <>


       README file and highlight webpage at