diff --git a/docusaurus.config.ts b/docusaurus.config.ts index 9e9fb76..b52eb96 100644 --- a/docusaurus.config.ts +++ b/docusaurus.config.ts @@ -74,6 +74,7 @@ const config: Config = { prism: { theme: catppuccinLatteTheme, darkTheme: catppuccinMochaTheme, + additionalLanguages: ['java', 'ini'] }, } satisfies Preset.ThemeConfig, plugins: [ diff --git a/package.json b/package.json index 130275a..71722ee 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "docusaurus2-dotenv": "^1.4.0", "postcss": "^8.4.38", "prism-react-renderer": "^2.3.1", + "prismjs": "^1.29.0", "react": "^18.2.0", "react-dom": "^18.2.0", "tailwindcss": "^3.4.3" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b74c127..1309385 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -32,6 +32,9 @@ dependencies: prism-react-renderer: specifier: ^2.3.1 version: 2.3.1(react@18.2.0) + prismjs: + specifier: ^1.29.0 + version: 1.29.0 react: specifier: ^18.2.0 version: 18.2.0 diff --git a/src/theme/prism-include-languages.js b/src/theme/prism-include-languages.js deleted file mode 100644 index 6e58656..0000000 --- a/src/theme/prism-include-languages.js +++ /dev/null @@ -1,27 +0,0 @@ -import siteConfig from '@generated/docusaurus.config'; -export default function prismIncludeLanguages(PrismObject) { - const { - themeConfig: {prism}, - } = siteConfig; - const {additionalLanguages} = prism; - // Prism components work on the Prism instance on the window, while prism- - // react-renderer uses its own Prism instance. We temporarily mount the - // instance onto window, import components to enhance it, then remove it to - // avoid polluting global namespace. - // You can mutate PrismObject: registering plugins, deleting languages... As - // long as you don't re-assign it - globalThis.Prism = PrismObject; - // additionalLanguages.forEach((lang) => { - // if (lang === 'php') { - // // eslint-disable-next-line global-require - // require('prismjs/components/prism-markup-templating.js'); - // } - // // eslint-disable-next-line global-require, import/no-dynamic-require - // require(`prismjs/components/prism-${lang}`); - - // }); - require('./languages/prism-ini.js'); - require('./languages/prism-shell-session.js'); - - delete globalThis.Prism; -}