fix: switch KaTeX loading from local to cdn

This commit is contained in:
radishzzz 2025-04-01 03:18:42 +01:00
parent ee25e17f69
commit c6d584a786
4 changed files with 7 additions and 12 deletions

View file

@ -23,7 +23,6 @@
"astro-og-canvas": "^0.7.0",
"astro-robots-txt": "^1.0.0",
"canvaskit-wasm": "^0.40.0",
"katex": "^0.16.21",
"markdown-it": "^14.1.0",
"overlayscrollbars": "^2.11.1",
"photoswipe": "^5.4.4",

11
pnpm-lock.yaml generated
View file

@ -38,9 +38,6 @@ importers:
canvaskit-wasm:
specifier: ^0.40.0
version: 0.40.0
katex:
specifier: ^0.16.21
version: 0.16.21
markdown-it:
specifier: ^14.1.0
version: 14.1.0
@ -1676,8 +1673,8 @@ packages:
duplexer@0.1.2:
resolution: {integrity: sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==}
electron-to-chromium@1.5.128:
resolution: {integrity: sha512-bo1A4HH/NS522Ws0QNFIzyPcyUUNV/yyy70Ho1xqfGYzPUme2F/xr4tlEOuM6/A538U1vDA7a4XfCd1CKRegKQ==}
electron-to-chromium@1.5.129:
resolution: {integrity: sha512-JlXUemX4s0+9f8mLqib/bHH8gOHf5elKS6KeWG3sk3xozb/JTq/RLXIv8OKUWiK4Ah00Wm88EFj5PYkFr4RUPA==}
emmet@2.4.11:
resolution: {integrity: sha512-23QPJB3moh/U9sT4rQzGgeyyGIrcM+GH5uVYg2C6wZIxAIJq7Ng3QLT79tl8FUwDXhyq9SusfknOrofAKqvgyQ==}
@ -5301,7 +5298,7 @@ snapshots:
browserslist@4.24.4:
dependencies:
caniuse-lite: 1.0.30001707
electron-to-chromium: 1.5.128
electron-to-chromium: 1.5.129
node-releases: 2.0.19
update-browserslist-db: 1.1.3(browserslist@4.24.4)
@ -5560,7 +5557,7 @@ snapshots:
duplexer@0.1.2: {}
electron-to-chromium@1.5.128: {}
electron-to-chromium@1.5.129: {}
emmet@2.4.11:
dependencies:

View file

@ -17,6 +17,7 @@ const langCode = currentLang === defaultLocale ? '' : `/${currentLang}`
const { title, subtitle, description, author, url, favicon, i18nTitle } = themeConfig.site
const { mode, light: { background: lightMode }, dark: { background: darkMode } } = themeConfig.color
const { katex } = themeConfig.global
const { verification = {}, twitterID = '', googleAnalyticsID = '', umamiAnalyticsID = '', apiflashKey = '' } = themeConfig.seo ?? {}
const { google = '', bing = '', yandex = '', baidu = '' } = verification
const { commentURL = '', imageHostURL = '', customGoogleAnalyticsJS = '', customUmamiAnalyticsJS = '' } = themeConfig.preload
@ -52,6 +53,8 @@ const pageImage = postSlug
<link rel="preload" href="/font/Snell-Black.woff2" as="font" type="font/woff2" crossorigin />
<link rel="preload" href="/font/EarlySummer-Subset.woff2" as="font" type="font/woff2" crossorigin />
<link rel="preload" href="/font/Snell-Bold.woff2" as="font" type="font/woff2" crossorigin />
{katex && <link rel="preconnect" href="https://cdn.jsdelivr.net" crossorigin />}
{katex && <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex/dist/katex.min.css" crossorigin />}
{commentURL && <link rel="preconnect" href={commentURL} crossorigin />}
{commentURL && <link rel="dns-prefetch" href={commentURL} />}
{imageHostURL && <link rel="preconnect" href={imageHostURL} crossorigin />}

View file

@ -11,10 +11,6 @@ import '@/styles/font.css'
import '@/styles/global.css'
import '@/styles/heti.css'
if (themeConfig.global.katex) {
await import('katex/dist/katex.min.css')
}
interface Props {
postTitle?: string
postDescription?: string