Skip to content

Commit 1016324

Browse files
[Line Numbers] Automatically attach to the global Prism instance (#3984)
Co-authored-by: Lea Verou <[email protected]>
1 parent e68a4bd commit 1016324

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/plugins/line-numbers/prism-line-numbers.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import prism from '../../global';
12
import { getParentPre, isActive } from '../../shared/dom-util';
23
import { isNonNull, noop } from '../../shared/util';
34
import { combineCallbacks } from '../../util/combine-callbacks';
@@ -199,7 +200,7 @@ export class LineNumbers {
199200
}
200201
}
201202

202-
export default {
203+
const Self = {
203204
id: 'line-numbers',
204205
plugin () {
205206
return new LineNumbers();
@@ -272,3 +273,7 @@ export default {
272273
return combineCallbacks(removeListener, completeHook);
273274
},
274275
} as PluginProto<'line-numbers'>;
276+
277+
export default Self;
278+
279+
prism.components.add(Self);

0 commit comments

Comments
 (0)