Skip to content
Discussion options

You must be logged in to vote

Hello, you can totally achieve this via swizzling. You would eject prism-include-languages and delete the line where it says delete globalThis.Prism. Alternatively, the Prism global object is imported from import {Prism} from 'prism-react-renderer'; (see here: https://github.com/facebook/docusaurus/blob/main/packages/docusaurus-theme-classic/src/prism-include-languages.ts), so in your own script, you could also import that instance and do globalThis.Prism = Prism; and it will work :) Alternatively, if you only depend on Prism being global for some time but not always (for example, you are loading another component or plugin), you can put your logic directly inside the ejected prism-includ…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@jcubic
Comment options

Comment options

You must be logged in to vote
1 reply
@jcubic
Comment options

Answer selected by jcubic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants