3
3
// eslint-disable-next-line
4
4
declare const hljs : HLJSApi ;
5
5
6
- interface HLJSApi {
6
+ type HLJSApi = PublicApi & ModesAPI
7
+
8
+ interface PublicApi {
7
9
highlight : ( languageName : string , code : string , ignoreIllegals ?: boolean , continuation ?: Mode ) => HighlightResult
8
10
highlightAuto : ( code : string , languageSubset ?: string [ ] ) => AutoHighlightResult
9
11
fixMarkup : ( html : string ) => string
@@ -24,7 +26,7 @@ interface HLJSApi {
24
26
versionString : string
25
27
}
26
28
27
- interface HLJSApi {
29
+ interface ModesAPI {
28
30
SHEBANG : ( mode ?: Partial < Mode > & { binary ?: string | RegExp } ) => Mode
29
31
BACKSLASH_ESCAPE : Mode
30
32
QUOTE_STRING_MODE : Mode
@@ -43,7 +45,7 @@ interface HLJSApi {
43
45
UNDERSCORE_TITLE_MODE : Mode
44
46
METHOD_GUARD : Mode
45
47
END_SAME_AS_BEGIN : ( mode : Mode ) => Mode
46
- // build in regex
48
+ // built in regex
47
49
IDENT_RE : string
48
50
UNDERSCORE_IDENT_RE : string
49
51
NUMBER_RE : string
@@ -52,13 +54,7 @@ interface HLJSApi {
52
54
RE_STARTERS_RE : string
53
55
}
54
56
55
- type LanguageFn = ( hljs : HLJSApi ) => Language
56
-
57
- // interface RawLanguage {
58
- // name?: string
59
- // aliases?: string[]
60
- // rawDefinition?: () => Language
61
- // }
57
+ type LanguageFn = ( hljs ?: HLJSApi ) => Language
62
58
63
59
interface HighlightResult {
64
60
relevance : number
@@ -73,23 +69,23 @@ interface HighlightResult {
73
69
// * for auto-highlight
74
70
second_best ? : Omit < HighlightResult , 'second_best' >
75
71
}
72
+ interface AutoHighlightResult extends HighlightResult { }
76
73
77
74
interface illegalData {
78
75
msg : string
79
76
context : string
80
77
mode : CompiledMode
81
78
}
82
79
83
- interface AutoHighlightResult extends HighlightResult {
84
- }
85
-
86
80
type PluginEvent =
87
81
'before:highlight'
88
82
| 'after:highlight'
89
83
| 'before:highlightBlock'
90
84
| 'after:highlightBlock'
91
85
92
- type HLJSPlugin = { [ K in PluginEvent ] ? : any }
86
+ type HLJSPlugin = {
87
+ [ K in PluginEvent ] ? : any
88
+ }
93
89
94
90
interface EmitterConstructor {
95
91
new ( opts : any ) : Emitter
0 commit comments