NAME

ansihighlight - syntax highlight for the terminal

SYNOPSIS

ansihighlight lib/Foo.pm
ansihighlight README.md
ansihighlight -w gnu script.sh
ansihighlight -w pandoc:haddock lib/Foo.pm
command | ansihighlight -l json

DESCRIPTION

ansihighlight prints files in colors for the terminal. The colors are those of a highlighter, a command which is installed: pandoc by default. A file whose language is not known is printed as it is, and so is every file when the highlighter is not installed.

The language is told from the extension of the file, from its name, or from the interpreter on its first line. In a Markdown file, the code in a fence is colored by the language of the fence, and the text around it as Markdown.

The standard input is read when no file is given, or for the file -. Its language is given by -l, or told from its first line.

OPTIONS

-w name, --with=name

The highlighter: pandoc (default), sourcehighlight (gnu) or skylighting (sky). See "HIGHLIGHTERS" in Text::ANSI::Highlight.

-s style, --style=style

The style of the highlighter, which gives the colors: its name, or a file. It can be written with the highlighter as well, after a colon: -w pandoc:haddock, -w gnu:esc256. See "STYLES" in Text::ANSI::Highlight.

-l language, --language=language

The language of all the files. markdown for a Markdown text.

--list-highlighters

Print the highlighters, and whether the command of each is found.

-h, --help
-v, --version

SEE ALSO

Text::ANSI::Highlight

AUTHOR

Kazumasa Utashiro

LICENSE

Copyright © 2026 Kazumasa Utashiro.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.