tree-sitter-ts-highlight-cli
v0.1.4
Published
Command-line wrapper for tree-sitter-ts-highlight.
Downloads
199
Maintainers
Readme
tree-sitter-ts-highlight-cli
Command-line wrapper for tree-sitter-ts-highlight.
Install
npm install -g tree-sitter-ts-highlight-cliOr run with npx:
npx tree-sitter-ts-highlight-cli --helpUsage
hlts [options]HTML highlight
hlts --input example.ts --language typescript --block --line-numbers > out.htmlANSI highlight (terminal)
hlts --input example.ts --ansi --line-numbersDiff highlight (HTML)
hlts --diff --old before.ts --new after.ts --view side-by-side > diff.htmlOptions
-i, --input <file>: input file path (default: stdin)-o, --output <file>: output file path (default: stdout)-l, --language <lang>: language name or extension--ansi: output ANSI-colored text--diff: output highlighted HTML diff (requires--oldand--new)--block: wrap HTML output in<pre><code>--line-numbers: include line numbers--start-line <n>: set starting line number--semantic: enable semantic token enhancement--theme <name>: built-in HTML theme name (fromtree-sitter-ts-highlight)--old <file>: old/original file for diff mode--new <file>: new/updated file for diff mode--view <mode>:side-by-sideorinline(diff mode)--old-label <label>: label for old side header--new-label <label>: label for new side header--no-header: hide diff header row-h, --help: show help-v, --version: show version
Programmatic API
import { runCli, parseCliArgs } from "tree-sitter-ts-highlight-cli";The package also re-exports all public APIs from tree-sitter-ts-highlight.
TypeScript types
This package also re-exports types from both tree-sitter-ts-highlight and tree-sitter-ts, so TypeScript libraries can consume those shared types directly:
import type { ThemeDefinition } from "tree-sitter-ts-highlight-cli";Test
npm testWatch mode:
npm run test:watch