UNPKG

tree-sitter-hast

Version:

Convert tree-sitter parsed trees to syntax-highlighted HAST

11 lines (10 loc) 638 B
import * as Parser from 'tree-sitter'; import { Tree } from 'tree-sitter'; import { Element, Text } from './hast'; import { PreparedLanguage } from './prepare-language'; export interface HighlightingOptions { classWhitelist?: string[]; } export declare function highlightTree(scopeMappings: any, text: string, tree: Tree, options?: HighlightingOptions): Element | Text; export declare function highlightText(language: PreparedLanguage, text: string, options?: HighlightingOptions): Element | Text; export declare function highlightText(parser: Parser, scopeMappings: any, text: string, options?: HighlightingOptions): Element | Text;