chore: remove conditional loading of katex plugins

This commit is contained in:
radishzzz 2025-05-08 18:53:10 +01:00
parent 5d2989d66d
commit afa47d4880

View file

@ -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: {