nxt-highlightjs 22.0.0 → 22.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +67 -64
- package/fesm2022/nxt-highlightjs-extras.mjs +142 -142
- package/fesm2022/nxt-highlightjs-extras.mjs.map +1 -1
- package/fesm2022/nxt-highlightjs-line-numbers.mjs +228 -248
- package/fesm2022/nxt-highlightjs-line-numbers.mjs.map +1 -1
- package/fesm2022/nxt-highlightjs.mjs +527 -559
- package/fesm2022/nxt-highlightjs.mjs.map +1 -1
- package/package.json +1 -1
- package/types/nxt-highlightjs-extras.d.ts +106 -113
- package/types/nxt-highlightjs-line-numbers.d.ts +25 -18
- package/types/nxt-highlightjs.d.ts +154 -128
|
@@ -1,141 +1,167 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
static ɵfac: _angular_core.ɵɵFactoryDeclaration<HighlightJS, never>;
|
|
10
|
-
static ɵprov: _angular_core.ɵɵInjectableDeclaration<HighlightJS>;
|
|
1
|
+
import { AutoHighlightResult, HLJSApi, HLJSOptions, HighlightResult, LanguageFn } from "highlight.js";
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
import { InjectionToken, InputSignal, OutputEmitterRef, WritableSignal } from "@angular/core";
|
|
4
|
+
export declare class HighlightJS {
|
|
5
|
+
private readonly loader;
|
|
6
|
+
readonly hljs: import("@angular/core").Signal<import("highlight.js").HLJSApi | undefined>;
|
|
7
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<HighlightJS, never>;
|
|
8
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
11
9
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
10
|
+
export declare abstract class HighlightBase {
|
|
11
|
+
protected readonly hljs: HighlightJS;
|
|
12
|
+
private readonly nativeElement;
|
|
13
|
+
private readonly sanitizer;
|
|
14
|
+
/**
|
|
15
|
+
* Code to highlight
|
|
16
|
+
*/
|
|
17
|
+
abstract readonly code: InputSignal<string | undefined>;
|
|
18
|
+
/**
|
|
19
|
+
* Highlighted result
|
|
20
|
+
*/
|
|
21
|
+
abstract readonly highlightResult: WritableSignal<HighlightResult | AutoHighlightResult | undefined>;
|
|
22
|
+
/**
|
|
23
|
+
* Stream that emits when code string is highlighted
|
|
24
|
+
*/
|
|
25
|
+
abstract readonly highlighted: OutputEmitterRef<HighlightResult | AutoHighlightResult | undefined>;
|
|
26
|
+
constructor();
|
|
27
|
+
/**
|
|
28
|
+
* Highlights the code with the loaded Highlight.js, or returns `undefined` to show it as text
|
|
29
|
+
*/
|
|
30
|
+
protected abstract highlightElement(code: string): HighlightResult | AutoHighlightResult | undefined;
|
|
31
|
+
private setTextContent;
|
|
32
|
+
private setInnerHTML;
|
|
33
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<HighlightBase, never>;
|
|
34
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<HighlightBase, never, never, {}, {}, never, never, true, never>;
|
|
35
35
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
36
|
+
export declare class HighlightAutoDirective extends HighlightBase {
|
|
37
|
+
/**
|
|
38
|
+
* Code to highlight
|
|
39
|
+
*/
|
|
40
|
+
readonly code: import("@angular/core").InputSignal<string | undefined>;
|
|
41
|
+
/**
|
|
42
|
+
* Highlighted result
|
|
43
|
+
*/
|
|
44
|
+
readonly highlightResult: import("@angular/core").WritableSignal<AutoHighlightResult | undefined>;
|
|
45
|
+
/**
|
|
46
|
+
* An optional array of language names and aliases restricting detection to only those languages
|
|
47
|
+
*
|
|
48
|
+
* The subset can also be set with configure, but the local parameter overrides the option if set.
|
|
49
|
+
*/
|
|
50
|
+
readonly languages: import("@angular/core").InputSignal<string[] | undefined>;
|
|
51
|
+
/**
|
|
52
|
+
* Stream that emits when code string is highlighted
|
|
53
|
+
*/
|
|
54
|
+
readonly highlighted: import("@angular/core").OutputEmitterRef<AutoHighlightResult>;
|
|
55
|
+
protected highlightElement(code: string): AutoHighlightResult | undefined;
|
|
56
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<HighlightAutoDirective, never>;
|
|
57
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<HighlightAutoDirective, "[nxtHighlightAuto]", never, {
|
|
58
|
+
"code": {
|
|
59
|
+
"alias": "nxtHighlightAuto";
|
|
60
|
+
"required": false;
|
|
61
|
+
"isSignal": true;
|
|
62
|
+
};
|
|
63
|
+
"languages": {
|
|
64
|
+
"alias": "languages";
|
|
65
|
+
"required": false;
|
|
66
|
+
"isSignal": true;
|
|
67
|
+
};
|
|
68
|
+
}, {
|
|
69
|
+
"highlighted": "highlighted";
|
|
70
|
+
}, never, never, true, never>;
|
|
59
71
|
}
|
|
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
|
-
|
|
72
|
+
export declare class HighlightDirective extends HighlightBase {
|
|
73
|
+
/**
|
|
74
|
+
* Code to highlight
|
|
75
|
+
*/
|
|
76
|
+
readonly code: import("@angular/core").InputSignal<string | undefined>;
|
|
77
|
+
/**
|
|
78
|
+
* Highlighted result
|
|
79
|
+
*/
|
|
80
|
+
readonly highlightResult: import("@angular/core").WritableSignal<HighlightResult | undefined>;
|
|
81
|
+
/**
|
|
82
|
+
* The language name highlight only one language
|
|
83
|
+
*
|
|
84
|
+
* Without it, or with a language that isn't loaded, the code shows as text.
|
|
85
|
+
*/
|
|
86
|
+
readonly language: import("@angular/core").InputSignal<string | undefined>;
|
|
87
|
+
/**
|
|
88
|
+
* An optional flag, when set to true it forces highlighting to finish even in case of detecting
|
|
89
|
+
* illegal syntax for the language instead of throwing an exception
|
|
90
|
+
*/
|
|
91
|
+
readonly ignoreIllegals: import("@angular/core").InputSignalWithTransform<boolean | undefined, unknown>;
|
|
92
|
+
/**
|
|
93
|
+
* Stream that emits when code string is highlighted
|
|
94
|
+
*/
|
|
95
|
+
readonly highlighted: import("@angular/core").OutputEmitterRef<HighlightResult>;
|
|
96
|
+
highlightElement(code: string): HighlightResult | undefined;
|
|
97
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<HighlightDirective, never>;
|
|
98
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<HighlightDirective, "[nxtHighlight]", never, {
|
|
99
|
+
"code": {
|
|
100
|
+
"alias": "nxtHighlight";
|
|
101
|
+
"required": false;
|
|
102
|
+
"isSignal": true;
|
|
103
|
+
};
|
|
104
|
+
"language": {
|
|
105
|
+
"alias": "language";
|
|
106
|
+
"required": false;
|
|
107
|
+
"isSignal": true;
|
|
108
|
+
};
|
|
109
|
+
"ignoreIllegals": {
|
|
110
|
+
"alias": "ignoreIllegals";
|
|
111
|
+
"required": false;
|
|
112
|
+
"isSignal": true;
|
|
113
|
+
};
|
|
114
|
+
}, {
|
|
115
|
+
"highlighted": "highlighted";
|
|
116
|
+
}, never, never, true, never>;
|
|
86
117
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
static ɵprov: _angular_core.ɵɵInjectableDeclaration<HighlightLoader>;
|
|
118
|
+
export declare class HighlightLoader {
|
|
119
|
+
private readonly document;
|
|
120
|
+
private readonly options;
|
|
121
|
+
private readonly pendingTasks;
|
|
122
|
+
private _t;
|
|
123
|
+
readonly hljs: import("@angular/core").Resource<HLJSApi | undefined>;
|
|
124
|
+
private themeLinkElement?;
|
|
125
|
+
constructor();
|
|
126
|
+
/**
|
|
127
|
+
* Lazy-Load highlight.js library
|
|
128
|
+
*/
|
|
129
|
+
private loadLibrary;
|
|
130
|
+
/**
|
|
131
|
+
* Lazy-load highlight.js languages
|
|
132
|
+
*/
|
|
133
|
+
private loadLanguages;
|
|
134
|
+
/**
|
|
135
|
+
* Reload theme styles
|
|
136
|
+
*/
|
|
137
|
+
setTheme(path: string): void;
|
|
138
|
+
/**
|
|
139
|
+
* Load theme
|
|
140
|
+
*/
|
|
141
|
+
private loadTheme;
|
|
142
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<HighlightLoader, never>;
|
|
143
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
114
144
|
}
|
|
115
|
-
|
|
116
145
|
/**
|
|
117
146
|
* Full documentation is available here https://highlightjs.readthedocs.io/en/latest/api.html
|
|
118
147
|
*/
|
|
119
|
-
interface LineNumbersOptions {
|
|
120
|
-
|
|
121
|
-
|
|
148
|
+
export interface LineNumbersOptions {
|
|
149
|
+
startFrom?: number;
|
|
150
|
+
singleLine?: boolean;
|
|
122
151
|
}
|
|
123
|
-
interface HighlightJSOptions {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
152
|
+
export interface HighlightJSOptions {
|
|
153
|
+
highlightOptions?: Partial<HLJSOptions>;
|
|
154
|
+
lineNumbersOptions?: LineNumbersOptions;
|
|
155
|
+
languages?: Record<string, () => Promise<LanguageFn>>;
|
|
156
|
+
coreLibraryLoader?: () => Promise<HLJSApi>;
|
|
157
|
+
fullLibraryLoader?: () => Promise<HLJSApi>;
|
|
158
|
+
lineNumbersLoader?: () => Promise<{
|
|
159
|
+
activateLineNumbers: (document: Document) => (code: string, options?: LineNumbersOptions) => string;
|
|
160
|
+
}>;
|
|
161
|
+
themePath?: string;
|
|
133
162
|
}
|
|
134
163
|
/**
|
|
135
164
|
* @internal
|
|
136
165
|
*/
|
|
137
|
-
declare const NXT_HIGHLIGHT_OPTIONS: InjectionToken<HighlightJSOptions>;
|
|
138
|
-
declare function provideHighlightOptions(options: HighlightJSOptions):
|
|
139
|
-
|
|
140
|
-
export { HighlightAutoDirective, HighlightBase, HighlightDirective, HighlightJS, HighlightLoader, NXT_HIGHLIGHT_OPTIONS, provideHighlightOptions };
|
|
141
|
-
export type { HighlightJSOptions, LineNumbersOptions };
|
|
166
|
+
export declare const NXT_HIGHLIGHT_OPTIONS: InjectionToken<HighlightJSOptions>;
|
|
167
|
+
export declare function provideHighlightOptions(options: HighlightJSOptions): import("@angular/core").EnvironmentProviders;
|