import { HighlightResult, HLJSPlugin } from 'highlight.js'; export interface TokenObject { kind: string; children: Array; sublanguage?: boolean; } interface RootNode { children: Array; } interface LanguageDefinition { aliases?: Array; keywords?: string | Record; disableAutodetect?: boolean; illegal?: string; contains?: Array; exports?: { preprocessor: any; strings: any; // Maybe Array keywords: any; // Probably the same as keywords above }; } declare class TokenTree { constructor(); top: () => Array; root: () => RootNode; rootNode: RootNode; stack: Array; add(node: TokenObject | string): void; openNode(kind: string): void; closeNode(): void; closeAllNodes(): void; toJSON(): string; walk(builder: T): T; static _walk(builder: T, node: string | Array): T; static _collapse(node: string | Array): void; } interface HighlightConfiguration { /** * Regex to configure which CSS classes should be completely skipped */ noHighlightRe?: RegExp; /** * Regex to configure how CSS class names map to language (allows class names like say color-as-php vs the default of language-php, etc.) */ languageDetectRe?: RegExp; /** * String used to replace TAB characters in indentation. */ classPrefix?: string; /** * A string used to replace TAB characters in indentation. */ tabReplace: string | null; /** * A flag to generate
tags instead of new-line characters in the output, useful when code is marked up using a non-
 container.
   */
  useBR: boolean;

  /**
   * An array of language names and aliases restricting auto detection to only these languages.
   */
  languages?: Array;

  /**
   * **Internal use only**
   */
  __emitter: TokenTreeEmitter;
}

declare class TokenTreeEmitter extends TokenTree {
  constructor(options: HighlightConfiguration);

  addKeyword(text: string, kind: string): void;
  addText(text: string): void;
  addSublanguage(emitter: any, name: string): void;
  toHTML(): string;
  finalize(): void;
}

interface HighlightAutoResult extends HighlightResult {}

export interface LeafyGreenHighlightResult
  extends Omit {
  _emitter: TokenTreeEmitter;
  react: React.ReactNode;
}

export interface LeafyGreenHLJSPlugin
  extends Omit {
  'after:highlight'?: (result: LeafyGreenHighlightResult) => void;
}