From afa47d4880c40dfb80d8dcc256218bfacb737dfb Mon Sep 17 00:00:00 2001 From: radishzzz Date: Thu, 8 May 2025 18:53:10 +0100 Subject: [PATCH] chore: remove conditional loading of katex plugins --- astro.config.ts | 45 ++++++++++++++++++++------------------------- 1 file changed, 20 insertions(+), 25 deletions(-) diff --git a/astro.config.ts b/astro.config.ts index e1bc6cb..704e41f 100644 --- a/astro.config.ts +++ b/astro.config.ts @@ -18,7 +18,6 @@ import { remarkReadingTime } from './src/plugins/remark-reading-time.mjs' const url = themeConfig.site.url const locale = themeConfig.global.locale -const isKatexEnabled = themeConfig.global.katex const linkPrefetch = themeConfig.preload.linkPrefetch const imageHostURL = themeConfig.preload.imageHostURL const imageConfig = imageHostURL @@ -32,28 +31,6 @@ const imageConfig = imageHostURL } : {} -const remarkPlugins = [ - remarkDirective, - ...(isKatexEnabled ? [remarkMath] : []), - remarkAdmonitions, - remarkGithubCard, - remarkReadingTime, -] - -const rehypePlugins = [ - rehypeSlug, - ...(isKatexEnabled ? [rehypeKatex] : []), - rehypeImgToFigure, - [ - rehypeExternalLinks, - { - target: '_blank', - rel: ['nofollow', 'noopener', 'noreferrer', 'external'], - protocols: ['http', 'https', 'mailto'], - }, - ], -] as any[] - export default defineConfig({ site: url, base: '/', @@ -84,8 +61,26 @@ export default defineConfig({ robotsTxt(), ], markdown: { - remarkPlugins, - rehypePlugins, + remarkPlugins: [ + remarkDirective, + remarkMath, + remarkAdmonitions, + remarkGithubCard, + remarkReadingTime, + ], + rehypePlugins: [ + rehypeSlug, + rehypeKatex, + rehypeImgToFigure, + [ + rehypeExternalLinks, + { + target: '_blank', + rel: ['nofollow', 'noopener', 'noreferrer', 'external'], + protocols: ['http', 'https', 'mailto'], + }, + ], + ], shikiConfig: { // Available themes: https://shiki.style/themes themes: {