-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathindex.d.ts
86 lines (82 loc) · 2.63 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// Generated by dts-bundle-generator v9.5.1
import { codeToHast, createHighlighter } from 'shiki';
export type SyntaxNode = {
type: string;
value: string;
lineNumber: number;
startIndex: number;
endIndex: number;
properties?: {
className?: string[];
[key: string]: any;
};
children?: SyntaxNode[];
};
export type SyntaxLine = {
value: string;
lineNumber: number;
valueLength: number;
nodeList: {
node: SyntaxNode;
wrapper?: SyntaxNode;
}[];
};
export declare const processAST: (ast: DiffAST) => {
syntaxFileObject: Record<number, SyntaxLine>;
syntaxFileLineNumber: number;
};
export type DiffHighlighterLang = "cpp" | "java" | "javascript" | "css" | "c#" | "c" | "c++" | "vue" | "vue-html" | "astro" | "bash" | "make" | "markdown" | "makefile" | "bat" | "cmake" | "cmd" | "csv" | "docker" | "dockerfile" | "go" | "python" | "html" | "jsx" | "tsx" | "typescript" | "sql" | "xml" | "sass" | "ssh-config" | "kotlin" | "json" | "swift" | "txt" | "diff";
declare function _getAST(raw: string, fileName?: string, lang?: DiffHighlighterLang, theme?: "light" | "dark"): DiffAST;
declare function _getAST(raw: string, fileName?: string, lang?: string, theme?: "light" | "dark"): DiffAST;
export type DePromise<T> = T extends Promise<infer U> ? DePromise<U> : T;
export type DiffAST = DePromise<ReturnType<typeof codeToHast>>;
export type DiffHighlighter = {
name: string;
type: "class" | "style" | string;
maxLineToIgnoreSyntax: number;
setMaxLineToIgnoreSyntax: (v: number) => void;
ignoreSyntaxHighlightList: (string | RegExp)[];
setIgnoreSyntaxHighlightList: (v: (string | RegExp)[]) => void;
getAST: typeof _getAST;
processAST: (ast: DiffAST) => {
syntaxFileObject: Record<number, SyntaxLine>;
syntaxFileLineNumber: number;
};
hasRegisteredCurrentLang: (lang: string) => boolean;
getHighlighterEngine: () => DePromise<ReturnType<typeof createHighlighter>> | null;
};
/**
* @deprecated
* try to use `getDiffViewHighlighter` instead
*
* @example
* ```ts
* import { highlighterReady } from '@git-diff-view/shiki'
*
* highlighterReady.then((highlighter) => {
* // do something with highlighter
* })
* ```
*/
export declare const highlighterReady: Promise<DiffHighlighter>;
/**
* get the shiki diffView highlighter
* @returns Promise<DiffHighlighter>
*
* @example
* ```ts
* import { getDiffViewHighlighter } from '@git-diff-view/shiki'
*
* getDiffViewHighlighter().then((highlighter) => {
* // do something with highlighter
* }
* ```
*/
export declare const getDiffViewHighlighter: () => Promise<DiffHighlighter>;
export declare const versions: string;
export * from "shiki";
export {
codeToHast,
createHighlighter,
};
export {};