TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/tree-sitter/tree-sitter/llms.txt
Use this file to discover all available pages before exploring further.
highlight command runs syntax highlighting on an arbitrary file. It can output colors directly to your terminal using ANSI escape codes, or produce HTML.
hi
For more information about syntax highlighting, see Syntax Highlighting.
Input Sources
File Paths
Pass file paths directly:Paths File
Use--paths to provide a file containing paths:
Standard Input
If no paths are provided, input is read from stdin:Output Formats
Terminal (ANSI)
By default, outputs colored text to the terminal:HTML
Generate an HTML document with syntax highlighting:HTML with CSS Classes
Generate HTML with CSS classes instead of inline styles:Options
Output Options
Output an HTML document with syntax highlighting.
Output HTML with CSS classes instead of inline styles. Must be used with
--html.Suppress main output.
Print the time taken to highlight the file.
Validation Options
Check that the highlighting captures conform strictly to the standards.
The path to a file with captures. These captures are considered the “standard” captures to compare against when using
--check.Query Options
The paths to query files to use for syntax highlighting. These should end in
highlights.scm. Can be specified multiple times.Input Options
The path to a file that contains paths to source files to highlight.
The path to the directory containing the grammar. Implies
--rebuild.The language scope to use for syntax highlighting. Useful when the language is ambiguous.
The encoding of the input files. One of
utf8, utf16-le, utf16-be.Highlight the contents of a specific test.
Build Options
Force a rebuild of the parser before highlighting.
The path to an alternative configuration (
config.json) file. See init-config.