File tree 1 file changed +6
-0
lines changed
packages/docusaurus-theme-classic/src/theme
1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,8 @@ export default function prismIncludeLanguages(
23
23
// avoid polluting global namespace.
24
24
// You can mutate PrismObject: registering plugins, deleting languages... As
25
25
// long as you don't re-assign it
26
+
27
+ const PrismBefore = globalThis . Prism ;
26
28
globalThis . Prism = PrismObject ;
27
29
28
30
additionalLanguages . forEach ( ( lang ) => {
@@ -34,5 +36,9 @@ export default function prismIncludeLanguages(
34
36
require ( `prismjs/components/prism-${ lang } ` ) ;
35
37
} ) ;
36
38
39
+ // Clean up and eventually restore former globalThis.Prism object (if any)
37
40
delete ( globalThis as Optional < typeof globalThis , 'Prism' > ) . Prism ;
41
+ if ( typeof PrismBefore !== 'undefined' ) {
42
+ globalThis . Prism = PrismObject ;
43
+ }
38
44
}
You can’t perform that action at this time.
0 commit comments