1// Docusaurus's own prism-include-languages, swizzled to add a small2// grammar for nushell (```nu blocks), which Prism doesn't ship.34import siteConfig from '@generated/docusaurus.config';5import type * as PrismNamespace from 'prismjs';6import type {Optional} from 'utility-types';7import nushell from '../prism/nushell';89export default function prismIncludeLanguages(PrismObject: typeof PrismNamespace): void {10 const {11 themeConfig: {prism},12 } = siteConfig;13 const {additionalLanguages} = prism as {additionalLanguages: string[]};1415 // Prism components enhance the Prism on the window; prism-react-renderer16 // has its own instance, mounted there while they load, then removed.17 const PrismBefore = globalThis.Prism;18 globalThis.Prism = PrismObject;1920 additionalLanguages.forEach((lang) => {21 // eslint-disable-next-line global-require, import/no-dynamic-require22 require(`prismjs/components/prism-${lang}`);23 });24 nushell(PrismObject);2526 delete (globalThis as Optional<typeof globalThis, 'Prism'>).Prism;27 if (typeof PrismBefore !== 'undefined') {28 globalThis.Prism = PrismObject;29 }30}