Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
highlight(1)		      user documentation		  highlight(1)

NAME
       Highlight - a universal sourcecode to formatted text converter

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

DESCRIPTION
       Highlight converts sourcecode to	HTML, XHTML, RTF, ODT, LaTeX, TeX, BB-
       Code, Pango markup, SVG,	XTERM or ANSI  escape  sequences.   There  are
       several	colour	themes available.  Highlight recognizes	keywords, num-
       bers, strings, comments,	symbols	and preprocessor directives.  It  sup-
       ports  about  180  programming  languages,  which  are  defined	in Lua
       scripts.

       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

       --config-file=<file>
	      set path to a lang or theme file

       -h, --help
	      print this help

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

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

       -d, --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 file suffix is miss-
	      ing

       -v, --verbose
	      print debug info to stderr

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

       --force
	      generate output if input syntax is unknown

       --list-scripts=<type>
	      list installed scripts <type> = [langs, themes, plugins]

       --plug-in=<script>
	      execute Lua plug-in script;  repeat  option  to  apply  multiple
	      plug-ins

       --plug-in-param
	      set  plug-in  input  parameter. This might be an input file name
	      (ie. 'tags').

       --print-config
	      print path configuration

       --print-style
	      print stylesheet only (see --style-outfile)

       --skip=<list>
	      ignore listed unknown file types (Example: --skip='bak;c~;h~')

       --start-nested=<lang>
	      define nested language which starts input	without	opening	delim-
	      iter

       --stdout
	      output to	stdout (batch mode, --print-style)

       --validate-input
	      test if input is a valid text file

       --version
	      print version and	copyright info

OUTPUT FORMATTING OPTIONS
       -O, --out-format=<format>
	      output  file  in given format <format>=[html, xhtml, latex, tex,
	      rtf, odt,	ansi, xterm256,	truecolor, bbcode, pango, svg]

       -c, --style-outfile=<file>
	      name of style definition file

       -T, --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 (see --keep-injec-
	      tions)

       -F, --reformat=<style>
	      reformat	output	in given style.	 <style>=[allman, gnu, google,
	      horstmann, java, kr, linux,  lisp,  mozilla,  otbs,  pico,  vtk,
	      ratliff, stroustrup, webkit, whitesmith, user]

	      The  user	style does not apply a predefined scheme. Use --refor-
	      mat-option to define reformatting	behaviour.

       --reformat-option=<opt>
	      apply an astyle cmd line option (assumes -F). Can	be repeated to
	      override settings	of the chosen indentation scheme.

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

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

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

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

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

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

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

       --line-range=<start-end>
	      output only lines	from number <start> to <end>

       -s, --style=<style name>
	      set highlighting style (theme)

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

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

       -V, --wrap-simple
	      wrap lines after 80 (default) characters without indenting func-
	      tion parameters and statements.

       -W, --wrap
	      wrap lines after 80 (default) characters (use with caution).

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

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

       --keep-injections
	      output plug-in header and	footer injections in spite of -f

       --kw-case=<upper|lower|capitalize>
	      output all keywords in given case	if language is not case	sensi-
	      tive

       --no-trailing-nl
	      omit trailing newline

       --no-version-info
	      omit version info	comment

       --wrap-no-numbers
	      omit line	numbers	of wrapped lines (assumes -l)

(X)HTML	OPTIONS
       -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

       -n, --ordered-list
	      print lines as ordered list items

       --class-name=<str>
	      set CSS class name prefix; omit class name if set	to "NONE"

       --inline-css
	      output CSS within	each tag (verbose output)

       --enclose-pre
	      enclose fragmented output	with pre tag (assumes -f)

LATEX OPTIONS
       -b, --babel
	      disable Babel package shorthands

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

       --beamer
	      adapt output for the Beamer package

       --pretty-symbols
	      improve appearance of brackets and other symbols

RTF OPTIONS
       --page-color
	      include page color attributes

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

       --char-styles
	      include character	stylesheets

SVG OPTIONS
       --height=<h>
	      set image	height (units allowed)

       --width=<w>
	      set image	size (see --height)

TERMINAL ESCAPE	OUTPUT OPTIONS (XTERM256 OR TRUECOLOR)
       --canvas[=width]
	      set background colour padding (default: 80)

GNU SOURCE-HIGHLIGHT COMPATIBILITY OPTIONS
       --doc  create stand alone document

       --no-doc
	      cancel the --doc option

       --css=filename
	      the external style sheet filename

       --src-lang=STRING
	      source language

	-t, --tab=INT
	      specify tab length

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

       --line-number-ref[=p]
	      number all output	lines and generate  an	anchor,	 made  of  the
	      specified	prefix
	       p + the line number  (default='line')

       --output-dir=path
	       output directory

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

ENV VARIABLES
       Highlight recognizes these variables:

       HIGHLIGHT_DATADIR
	      sets the path to highlight's configuration scripts

       HIGHLIGHT_OPTIONS
	      may contain command line options,	but no input file paths.

HINTS
       If no in- or output files are specified,	stdin and stdout will be  used
       for  in-	or output.  HTML will be generated unless an other output for-
       mat 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 (-F)  will only work with C, C++, C# and Java
       input files.

BUGS
       Wrapping	 lines	with  -V  or -W	will cause faulty highlighting of long
       single line comments and	directives.  Using line-range might  interfere
       with multi line syntax elements.	Use with caution.

FILES
       The  configuration files	are stored in /usr/share/highlight/.  Language
       definitions, themes and plugins are located in subdirectories.

       Documentation files are stored in /usr/share/doc/highlight/ ,  configu-
       ration files in /etc/highlight/.

       See README how to install own scripts in	the home directory.

EXAMPLES
       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 --out-format=xhtml  -B	'*.cpp'	-d /home/you/html_code/

       converts	 all  *.cpp files in the current directory and its subdirecto-
       ries to xhtml files, and	stores the output in /home/you/html_code.

       highlight --out-format=latex  * -d /home/you/latex_code/

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

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

       Use  highlight  --out-format=xterm256 <yourfile>	| less -R to display a
       source file in a	terminal.

       Run highlight --list-scripts=langs to see all supported syntax types.

AUTHORS
       Andre Simon <as@andre-simon.de>

SEE ALSO
       README file and highlight webpage at http://www.andre-simon.de/.

Andre Simon			  2018-04-30			  highlight(1)

NAME | SYNOPSIS | DESCRIPTION | GENERAL OPTIONS | OUTPUT FORMATTING OPTIONS | (X)HTML OPTIONS | LATEX OPTIONS | RTF OPTIONS | SVG OPTIONS | TERMINAL ESCAPE OUTPUT OPTIONS (XTERM256 OR TRUECOLOR) | GNU SOURCE-HIGHLIGHT COMPATIBILITY OPTIONS | ENV VARIABLES | HINTS | BUGS | FILES | EXAMPLES | AUTHORS | SEE ALSO

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=highlight&sektion=1&manpath=FreeBSD+13.0-RELEASE+and+Ports>

home | help