-
Notifications
You must be signed in to change notification settings - Fork 29.9k
/
index.d.ts
82 lines (70 loc) · 2.67 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
// Type definitions for highlight.js v7.5.0
// Project: https://github.com/isagalaev/highlight.js
// Definitions by: Niklas Mollenhauer <https://github.com/nikeee/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module "highlight.js"
{
namespace hljs
{
export var LANGUAGES: { [name: string] : any; };
export function blockText(block: Node, ignoreNewLines: boolean) : string;
export function blockLanguage(block: Node) : string;
export function highlight(language_name: string, value: string) : IHighlightResult
export function highlightAuto(text: string) : IHighlightResult
export function fixMarkup(value: string, tabReplace: boolean, useBR: boolean) : string;
export function highlightBlock(block: Node, tabReplace?: boolean, useBR?: boolean) : void;
export function initHighlighting(): void;
export function initHighlightingOnLoad(): void;
export var tabReplace : string;
// Common regexps
export var IDENT_RE: string;
export var UNDERSCORE_IDENT_RE: string;
export var NUMBER_RE: string;
export var C_NUMBER_RE: string;
export var BINARY_NUMBER_RE: string;
export var RE_STARTERS_RE: string;
// Common modes
export var BACKSLASH_ESCAPE : IMode;
export var APOS_STRING_MODE : IMode;
export var QUOTE_STRING_MODE : IMode;
export var C_LINE_COMMENT_MODE : IMode;
export var C_BLOCK_COMMENT_MODE : IMode;
export var HASH_COMMENT_MODE : IMode;
export var NUMBER_MODE : IMode;
export var C_NUMBER_MODE : IMode;
export var BINARY_NUMBER_MODE : IMode;
export interface IHighlightResult
{
relevance: number;
keyword_count: number;
value: string;
}
export interface IAutoHighlightResult extends IHighlightResult
{
language: string;
second_best?: IAutoHighlightResult;
}
// Reference:
// https://github.com/isagalaev/highlight.js/blob/master/docs/reference.rst
export interface IMode
{
className?: string;
begin: string;
end?: string;
beginWithKeyword?: boolean;
endsWithParent?: boolean;
lexems?: string;
keywords?: Object;
illegal?: string;
excludeBegin?: boolean;
excludeEnd?: boolean;
returnBegin?: boolean;
returnEnd?: boolean;
contains?: IMode[];
starts?: string;
subLanguage?: string;
relevance?: number;
}
}
export = hljs;
}