From ee25e17f690b262b258fc9d474c675fc9cb45e90 Mon Sep 17 00:00:00 2001 From: radishzzz Date: Tue, 1 Apr 2025 02:13:23 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20add=20KaTeX=20support=20and?= =?UTF-8?q?=20update=20theme=20configuration?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Update @astrojs/mdx and astro dependencies - Enable KaTeX in theme config for mathematical formula rendering - Update scrollbar component to hide overflow content - Add KaTeX mathematical demonstration document - Update multilingual theme guides to include KaTeX configuration --- package.json | 5 +- pnpm-lock.yaml | 157 +++++++++--------- src/components/Widgets/Scrollbar.astro | 9 + src/config.ts | 2 + src/content/posts/KaTeX Mathematical Demo.md | 150 +++++++++++++++++ src/content/posts/guides/Theme Guide-en.md | 2 + src/content/posts/guides/Theme Guide-es.md | 2 + src/content/posts/guides/Theme Guide-ja.md | 4 +- src/content/posts/guides/Theme Guide-ru.md | 3 +- src/content/posts/guides/Theme Guide-zh-tw.md | 4 +- src/content/posts/guides/Theme Guide-zh.md | 4 +- src/layouts/Layout.astro | 4 + src/types/index.d.ts | 1 + 13 files changed, 264 insertions(+), 83 deletions(-) create mode 100644 src/content/posts/KaTeX Mathematical Demo.md diff --git a/package.json b/package.json index 6498c4f..d892342 100644 --- a/package.json +++ b/package.json @@ -13,16 +13,17 @@ "lint:fix": "eslint . --fix" }, "dependencies": { - "@astrojs/mdx": "^4.2.2", + "@astrojs/mdx": "^4.2.3", "@astrojs/partytown": "^2.1.4", "@astrojs/rss": "^4.0.11", "@astrojs/sitemap": "^3.3.0", "@waline/client": "^3.5.6", - "astro": "^5.5.5", + "astro": "^5.5.6", "astro-compress": "^2.3.7", "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", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 99a57c3..62cdd2c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,8 +9,8 @@ importers: .: dependencies: '@astrojs/mdx': - specifier: ^4.2.2 - version: 4.2.2(astro@5.5.5(@types/node@22.13.14)(jiti@2.4.2)(lightningcss@1.29.3)(rollup@4.38.0)(terser@5.39.0)(typescript@5.8.2)(yaml@2.7.1)) + specifier: ^4.2.3 + version: 4.2.3(astro@5.5.6(@types/node@22.13.14)(jiti@2.4.2)(lightningcss@1.29.3)(rollup@4.38.0)(terser@5.39.0)(typescript@5.8.2)(yaml@2.7.1)) '@astrojs/partytown': specifier: ^2.1.4 version: 2.1.4 @@ -24,20 +24,23 @@ importers: specifier: ^3.5.6 version: 3.5.6(typescript@5.8.2) astro: - specifier: ^5.5.5 - version: 5.5.5(@types/node@22.13.14)(jiti@2.4.2)(lightningcss@1.29.3)(rollup@4.38.0)(terser@5.39.0)(typescript@5.8.2)(yaml@2.7.1) + specifier: ^5.5.6 + version: 5.5.6(@types/node@22.13.14)(jiti@2.4.2)(lightningcss@1.29.3)(rollup@4.38.0)(terser@5.39.0)(typescript@5.8.2)(yaml@2.7.1) astro-compress: specifier: ^2.3.7 version: 2.3.7(@types/node@22.13.14)(jiti@2.4.2)(rollup@4.38.0)(typescript@5.8.2)(yaml@2.7.1) astro-og-canvas: specifier: ^0.7.0 - version: 0.7.0(astro@5.5.5(@types/node@22.13.14)(jiti@2.4.2)(lightningcss@1.29.3)(rollup@4.38.0)(terser@5.39.0)(typescript@5.8.2)(yaml@2.7.1)) + version: 0.7.0(astro@5.5.6(@types/node@22.13.14)(jiti@2.4.2)(lightningcss@1.29.3)(rollup@4.38.0)(terser@5.39.0)(typescript@5.8.2)(yaml@2.7.1)) astro-robots-txt: specifier: ^1.0.0 version: 1.0.0 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 @@ -65,7 +68,7 @@ importers: devDependencies: '@antfu/eslint-config': specifier: ^4.11.0 - version: 4.11.0(@typescript-eslint/utils@8.28.0(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2))(@unocss/eslint-plugin@66.1.0-beta.8(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2))(@vue/compiler-sfc@3.5.13)(astro-eslint-parser@1.2.2)(eslint-plugin-astro@1.3.1(eslint@9.23.0(jiti@2.4.2)))(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2) + version: 4.11.0(@typescript-eslint/utils@8.29.0(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2))(@unocss/eslint-plugin@66.1.0-beta.8(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2))(@vue/compiler-sfc@3.5.13)(astro-eslint-parser@1.2.2)(eslint-plugin-astro@1.3.1(eslint@9.23.0(jiti@2.4.2)))(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2) '@astrojs/check': specifier: ^0.9.4 version: 0.9.4(typescript@5.8.2) @@ -206,8 +209,8 @@ packages: '@astrojs/markdown-remark@6.3.1': resolution: {integrity: sha512-c5F5gGrkczUaTVgmMW9g1YMJGzOtRvjjhw6IfGuxarM6ct09MpwysP10US729dy07gg8y+ofVifezvP3BNsWZg==} - '@astrojs/mdx@4.2.2': - resolution: {integrity: sha512-nWDvuCPenxoxbog3YK3yVWF3Jw7Lq1+ziWSAOc9fy6zAUbPDSr2bt3c6r6+oa1ll0miCQByj5UVts6eJvN/y+g==} + '@astrojs/mdx@4.2.3': + resolution: {integrity: sha512-oteB88udzzZmix5kWWUMeMJfeB2Dj8g7jy9LVNuTzGlBh3mEkGhQr6FsIR43p0JKCN11fl5J7P/Ev4Q0Nf0KQQ==} engines: {node: ^18.17.1 || ^20.3.0 || >=22.0.0} peerDependencies: astro: ^5.0.0 @@ -925,51 +928,51 @@ packages: '@types/web-bluetooth@0.0.21': resolution: {integrity: sha512-oIQLCGWtcFZy2JW77j9k8nHzAOpqMHLQejDA48XXMWH6tjCQHz5RCFz1bzsmROyL6PUm+LLnUiI4BCn221inxA==} - '@typescript-eslint/eslint-plugin@8.28.0': - resolution: {integrity: sha512-lvFK3TCGAHsItNdWZ/1FkvpzCxTHUVuFrdnOGLMa0GGCFIbCgQWVk3CzCGdA7kM3qGVc+dfW9tr0Z/sHnGDFyg==} + '@typescript-eslint/eslint-plugin@8.29.0': + resolution: {integrity: sha512-PAIpk/U7NIS6H7TEtN45SPGLQaHNgB7wSjsQV/8+KYokAb2T/gloOA/Bee2yd4/yKVhPKe5LlaUGhAZk5zmSaQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: '@typescript-eslint/parser': ^8.0.0 || ^8.0.0-alpha.0 eslint: ^8.57.0 || ^9.0.0 typescript: '>=4.8.4 <5.9.0' - '@typescript-eslint/parser@8.28.0': - resolution: {integrity: sha512-LPcw1yHD3ToaDEoljFEfQ9j2xShY367h7FZ1sq5NJT9I3yj4LHer1Xd1yRSOdYy9BpsrxU7R+eoDokChYM53lQ==} + '@typescript-eslint/parser@8.29.0': + resolution: {integrity: sha512-8C0+jlNJOwQso2GapCVWWfW/rzaq7Lbme+vGUFKE31djwNncIpgXD7Cd4weEsDdkoZDjH0lwwr3QDQFuyrMg9g==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.57.0 || ^9.0.0 typescript: '>=4.8.4 <5.9.0' - '@typescript-eslint/scope-manager@8.28.0': - resolution: {integrity: sha512-u2oITX3BJwzWCapoZ/pXw6BCOl8rJP4Ij/3wPoGvY8XwvXflOzd1kLrDUUUAIEdJSFh+ASwdTHqtan9xSg8buw==} + '@typescript-eslint/scope-manager@8.29.0': + resolution: {integrity: sha512-aO1PVsq7Gm+tcghabUpzEnVSFMCU4/nYIgC2GOatJcllvWfnhrgW0ZEbnTxm36QsikmCN1K/6ZgM7fok2I7xNw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@typescript-eslint/type-utils@8.28.0': - resolution: {integrity: sha512-oRoXu2v0Rsy/VoOGhtWrOKDiIehvI+YNrDk5Oqj40Mwm0Yt01FC/Q7nFqg088d3yAsR1ZcZFVfPCTTFCe/KPwg==} + '@typescript-eslint/type-utils@8.29.0': + resolution: {integrity: sha512-ahaWQ42JAOx+NKEf5++WC/ua17q5l+j1GFrbbpVKzFL/tKVc0aYY8rVSYUpUvt2hUP1YBr7mwXzx+E/DfUWI9Q==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.57.0 || ^9.0.0 typescript: '>=4.8.4 <5.9.0' - '@typescript-eslint/types@8.28.0': - resolution: {integrity: sha512-bn4WS1bkKEjx7HqiwG2JNB3YJdC1q6Ue7GyGlwPHyt0TnVq6TtD/hiOdTZt71sq0s7UzqBFXD8t8o2e63tXgwA==} + '@typescript-eslint/types@8.29.0': + resolution: {integrity: sha512-wcJL/+cOXV+RE3gjCyl/V2G877+2faqvlgtso/ZRbTCnZazh0gXhe+7gbAnfubzN2bNsBtZjDvlh7ero8uIbzg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@typescript-eslint/typescript-estree@8.28.0': - resolution: {integrity: sha512-H74nHEeBGeklctAVUvmDkxB1mk+PAZ9FiOMPFncdqeRBXxk1lWSYraHw8V12b7aa6Sg9HOBNbGdSHobBPuQSuA==} + '@typescript-eslint/typescript-estree@8.29.0': + resolution: {integrity: sha512-yOfen3jE9ISZR/hHpU/bmNvTtBW1NjRbkSFdZOksL1N+ybPEE7UVGMwqvS6CP022Rp00Sb0tdiIkhSCe6NI8ow==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: typescript: '>=4.8.4 <5.9.0' - '@typescript-eslint/utils@8.28.0': - resolution: {integrity: sha512-OELa9hbTYciYITqgurT1u/SzpQVtDLmQMFzy/N8pQE+tefOyCWT79jHsav294aTqV1q1u+VzqDGbuujvRYaeSQ==} + '@typescript-eslint/utils@8.29.0': + resolution: {integrity: sha512-gX/A0Mz9Bskm8avSWFcK0gP7cZpbY4AIo6B0hWYFCaIsz750oaiWR4Jr2CI+PQhfW1CpcQr9OlfPS+kMFegjXA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.57.0 || ^9.0.0 typescript: '>=4.8.4 <5.9.0' - '@typescript-eslint/visitor-keys@8.28.0': - resolution: {integrity: sha512-hbn8SZ8w4u2pRwgQ1GlUrPKE+t2XvcCW5tTRF7j6SMYIuYG37XuzIW44JCZPa36evi0Oy2SnM664BlIaAuQcvg==} + '@typescript-eslint/visitor-keys@8.29.0': + resolution: {integrity: sha512-Sne/pVz8ryR03NFK21VpN88dZ2FdQXOlq3VIklbrTYEt8yXtRFr9tvUhqvCeKjqYk5FSim37sHbooT6vzBTZcg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} '@ungap/structured-clone@1.3.0': @@ -1323,8 +1326,8 @@ packages: astro-robots-txt@1.0.0: resolution: {integrity: sha512-6JQSLid4gMhoWjOm85UHLkgrw0+hHIjnJVIUqxjU2D6feKlVyYukMNYjH44ZDZBK1P8hNxd33PgWlHzCASvedA==} - astro@5.5.5: - resolution: {integrity: sha512-fdnnK5dhWNIQT/cXzvaGs9il4T5noi4jafobdntbuNOrRxI1JnOxDfrtBadUo6cknCRCFhYrXh4VndCqj1a4Sg==} + astro@5.5.6: + resolution: {integrity: sha512-SjU6zAlRe/gQrZ558Qhm211Yl8XOZBfjMpZig3XtQpG6zlyHJkElbWQIWXAVPzMg17cFVdv/qZPVHfcP2YOGGw==} engines: {node: ^18.17.1 || ^20.3.0 || >=22.0.0, npm: '>=9.6.5', pnpm: '>=7.1.0'} hasBin: true @@ -3790,16 +3793,16 @@ snapshots: '@jridgewell/gen-mapping': 0.3.8 '@jridgewell/trace-mapping': 0.3.25 - '@antfu/eslint-config@4.11.0(@typescript-eslint/utils@8.28.0(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2))(@unocss/eslint-plugin@66.1.0-beta.8(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2))(@vue/compiler-sfc@3.5.13)(astro-eslint-parser@1.2.2)(eslint-plugin-astro@1.3.1(eslint@9.23.0(jiti@2.4.2)))(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2)': + '@antfu/eslint-config@4.11.0(@typescript-eslint/utils@8.29.0(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2))(@unocss/eslint-plugin@66.1.0-beta.8(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2))(@vue/compiler-sfc@3.5.13)(astro-eslint-parser@1.2.2)(eslint-plugin-astro@1.3.1(eslint@9.23.0(jiti@2.4.2)))(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2)': dependencies: '@antfu/install-pkg': 1.0.0 '@clack/prompts': 0.10.0 '@eslint-community/eslint-plugin-eslint-comments': 4.4.1(eslint@9.23.0(jiti@2.4.2)) '@eslint/markdown': 6.3.0 '@stylistic/eslint-plugin': 4.2.0(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2) - '@typescript-eslint/eslint-plugin': 8.28.0(@typescript-eslint/parser@8.28.0(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2))(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2) - '@typescript-eslint/parser': 8.28.0(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2) - '@vitest/eslint-plugin': 1.1.38(@typescript-eslint/utils@8.28.0(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2))(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2) + '@typescript-eslint/eslint-plugin': 8.29.0(@typescript-eslint/parser@8.29.0(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2))(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2) + '@typescript-eslint/parser': 8.29.0(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2) + '@vitest/eslint-plugin': 1.1.38(@typescript-eslint/utils@8.29.0(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2))(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2) ansis: 3.17.0 cac: 6.7.14 eslint: 9.23.0(jiti@2.4.2) @@ -3818,7 +3821,7 @@ snapshots: eslint-plugin-regexp: 2.7.0(eslint@9.23.0(jiti@2.4.2)) eslint-plugin-toml: 0.12.0(eslint@9.23.0(jiti@2.4.2)) eslint-plugin-unicorn: 57.0.0(eslint@9.23.0(jiti@2.4.2)) - eslint-plugin-unused-imports: 4.1.4(@typescript-eslint/eslint-plugin@8.28.0(@typescript-eslint/parser@8.28.0(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2))(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2))(eslint@9.23.0(jiti@2.4.2)) + eslint-plugin-unused-imports: 4.1.4(@typescript-eslint/eslint-plugin@8.29.0(@typescript-eslint/parser@8.29.0(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2))(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2))(eslint@9.23.0(jiti@2.4.2)) eslint-plugin-vue: 10.0.0(eslint@9.23.0(jiti@2.4.2))(vue-eslint-parser@10.1.1(eslint@9.23.0(jiti@2.4.2))) eslint-plugin-yml: 1.17.0(eslint@9.23.0(jiti@2.4.2)) eslint-processor-vue-blocks: 2.0.0(@vue/compiler-sfc@3.5.13)(eslint@9.23.0(jiti@2.4.2)) @@ -3912,12 +3915,12 @@ snapshots: transitivePeerDependencies: - supports-color - '@astrojs/mdx@4.2.2(astro@5.5.5(@types/node@22.13.14)(jiti@2.4.2)(lightningcss@1.29.3)(rollup@4.38.0)(terser@5.39.0)(typescript@5.8.2)(yaml@2.7.1))': + '@astrojs/mdx@4.2.3(astro@5.5.6(@types/node@22.13.14)(jiti@2.4.2)(lightningcss@1.29.3)(rollup@4.38.0)(terser@5.39.0)(typescript@5.8.2)(yaml@2.7.1))': dependencies: '@astrojs/markdown-remark': 6.3.1 '@mdx-js/mdx': 3.1.0(acorn@8.14.1) acorn: 8.14.1 - astro: 5.5.5(@types/node@22.13.14)(jiti@2.4.2)(lightningcss@1.29.3)(rollup@4.38.0)(terser@5.39.0)(typescript@5.8.2)(yaml@2.7.1) + astro: 5.5.6(@types/node@22.13.14)(jiti@2.4.2)(lightningcss@1.29.3)(rollup@4.38.0)(terser@5.39.0)(typescript@5.8.2)(yaml@2.7.1) es-module-lexer: 1.6.0 estree-util-visit: 2.0.0 hast-util-to-html: 9.0.5 @@ -4046,7 +4049,7 @@ snapshots: dependencies: '@types/eslint': 9.6.1 '@types/estree': 1.0.7 - '@typescript-eslint/types': 8.28.0 + '@typescript-eslint/types': 8.29.0 comment-parser: 1.4.1 esquery: 1.6.0 jsdoc-type-pratt-parser: 4.1.0 @@ -4493,7 +4496,7 @@ snapshots: '@stylistic/eslint-plugin@4.2.0(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2)': dependencies: - '@typescript-eslint/utils': 8.28.0(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2) + '@typescript-eslint/utils': 8.29.0(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2) eslint: 9.23.0(jiti@2.4.2) eslint-visitor-keys: 4.2.0 espree: 10.3.0 @@ -4586,14 +4589,14 @@ snapshots: '@types/web-bluetooth@0.0.21': {} - '@typescript-eslint/eslint-plugin@8.28.0(@typescript-eslint/parser@8.28.0(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2))(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2)': + '@typescript-eslint/eslint-plugin@8.29.0(@typescript-eslint/parser@8.29.0(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2))(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2)': dependencies: '@eslint-community/regexpp': 4.12.1 - '@typescript-eslint/parser': 8.28.0(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2) - '@typescript-eslint/scope-manager': 8.28.0 - '@typescript-eslint/type-utils': 8.28.0(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2) - '@typescript-eslint/utils': 8.28.0(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2) - '@typescript-eslint/visitor-keys': 8.28.0 + '@typescript-eslint/parser': 8.29.0(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2) + '@typescript-eslint/scope-manager': 8.29.0 + '@typescript-eslint/type-utils': 8.29.0(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2) + '@typescript-eslint/utils': 8.29.0(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2) + '@typescript-eslint/visitor-keys': 8.29.0 eslint: 9.23.0(jiti@2.4.2) graphemer: 1.4.0 ignore: 5.3.2 @@ -4603,27 +4606,27 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/parser@8.28.0(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2)': + '@typescript-eslint/parser@8.29.0(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2)': dependencies: - '@typescript-eslint/scope-manager': 8.28.0 - '@typescript-eslint/types': 8.28.0 - '@typescript-eslint/typescript-estree': 8.28.0(typescript@5.8.2) - '@typescript-eslint/visitor-keys': 8.28.0 + '@typescript-eslint/scope-manager': 8.29.0 + '@typescript-eslint/types': 8.29.0 + '@typescript-eslint/typescript-estree': 8.29.0(typescript@5.8.2) + '@typescript-eslint/visitor-keys': 8.29.0 debug: 4.4.0 eslint: 9.23.0(jiti@2.4.2) typescript: 5.8.2 transitivePeerDependencies: - supports-color - '@typescript-eslint/scope-manager@8.28.0': + '@typescript-eslint/scope-manager@8.29.0': dependencies: - '@typescript-eslint/types': 8.28.0 - '@typescript-eslint/visitor-keys': 8.28.0 + '@typescript-eslint/types': 8.29.0 + '@typescript-eslint/visitor-keys': 8.29.0 - '@typescript-eslint/type-utils@8.28.0(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2)': + '@typescript-eslint/type-utils@8.29.0(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2)': dependencies: - '@typescript-eslint/typescript-estree': 8.28.0(typescript@5.8.2) - '@typescript-eslint/utils': 8.28.0(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2) + '@typescript-eslint/typescript-estree': 8.29.0(typescript@5.8.2) + '@typescript-eslint/utils': 8.29.0(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2) debug: 4.4.0 eslint: 9.23.0(jiti@2.4.2) ts-api-utils: 2.1.0(typescript@5.8.2) @@ -4631,12 +4634,12 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/types@8.28.0': {} + '@typescript-eslint/types@8.29.0': {} - '@typescript-eslint/typescript-estree@8.28.0(typescript@5.8.2)': + '@typescript-eslint/typescript-estree@8.29.0(typescript@5.8.2)': dependencies: - '@typescript-eslint/types': 8.28.0 - '@typescript-eslint/visitor-keys': 8.28.0 + '@typescript-eslint/types': 8.29.0 + '@typescript-eslint/visitor-keys': 8.29.0 debug: 4.4.0 fast-glob: 3.3.3 is-glob: 4.0.3 @@ -4647,20 +4650,20 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/utils@8.28.0(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2)': + '@typescript-eslint/utils@8.29.0(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2)': dependencies: '@eslint-community/eslint-utils': 4.5.1(eslint@9.23.0(jiti@2.4.2)) - '@typescript-eslint/scope-manager': 8.28.0 - '@typescript-eslint/types': 8.28.0 - '@typescript-eslint/typescript-estree': 8.28.0(typescript@5.8.2) + '@typescript-eslint/scope-manager': 8.29.0 + '@typescript-eslint/types': 8.29.0 + '@typescript-eslint/typescript-estree': 8.29.0(typescript@5.8.2) eslint: 9.23.0(jiti@2.4.2) typescript: 5.8.2 transitivePeerDependencies: - supports-color - '@typescript-eslint/visitor-keys@8.28.0': + '@typescript-eslint/visitor-keys@8.29.0': dependencies: - '@typescript-eslint/types': 8.28.0 + '@typescript-eslint/types': 8.29.0 eslint-visitor-keys: 4.2.0 '@ungap/structured-clone@1.3.0': {} @@ -4702,7 +4705,7 @@ snapshots: '@unocss/eslint-plugin@66.1.0-beta.8(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2)': dependencies: - '@typescript-eslint/utils': 8.28.0(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2) + '@typescript-eslint/utils': 8.29.0(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2) '@unocss/config': 66.1.0-beta.8 '@unocss/core': 66.1.0-beta.8 '@unocss/rule-utils': 66.1.0-beta.8 @@ -4883,9 +4886,9 @@ snapshots: '@unrs/resolver-binding-win32-x64-msvc@1.3.3': optional: true - '@vitest/eslint-plugin@1.1.38(@typescript-eslint/utils@8.28.0(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2))(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2)': + '@vitest/eslint-plugin@1.1.38(@typescript-eslint/utils@8.29.0(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2))(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2)': dependencies: - '@typescript-eslint/utils': 8.28.0(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2) + '@typescript-eslint/utils': 8.29.0(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2) eslint: 9.23.0(jiti@2.4.2) optionalDependencies: typescript: 5.8.2 @@ -5085,7 +5088,7 @@ snapshots: '@playform/pipe': 0.1.3 '@types/csso': 5.0.4 '@types/html-minifier-terser': 7.0.2 - astro: 5.5.5(@types/node@22.13.14)(jiti@2.4.2)(lightningcss@1.29.3)(rollup@4.38.0)(terser@5.39.0)(typescript@5.8.2)(yaml@2.7.1) + astro: 5.5.6(@types/node@22.13.14)(jiti@2.4.2)(lightningcss@1.29.3)(rollup@4.38.0)(terser@5.39.0)(typescript@5.8.2)(yaml@2.7.1) commander: 13.1.0 csso: 5.0.5 deepmerge-ts: 7.1.5 @@ -5131,8 +5134,8 @@ snapshots: astro-eslint-parser@1.2.2: dependencies: '@astrojs/compiler': 2.11.0 - '@typescript-eslint/scope-manager': 8.28.0 - '@typescript-eslint/types': 8.28.0 + '@typescript-eslint/scope-manager': 8.29.0 + '@typescript-eslint/types': 8.29.0 astrojs-compiler-sync: 1.0.1(@astrojs/compiler@2.11.0) debug: 4.4.0 entities: 6.0.0 @@ -5145,9 +5148,9 @@ snapshots: transitivePeerDependencies: - supports-color - astro-og-canvas@0.7.0(astro@5.5.5(@types/node@22.13.14)(jiti@2.4.2)(lightningcss@1.29.3)(rollup@4.38.0)(terser@5.39.0)(typescript@5.8.2)(yaml@2.7.1)): + astro-og-canvas@0.7.0(astro@5.5.6(@types/node@22.13.14)(jiti@2.4.2)(lightningcss@1.29.3)(rollup@4.38.0)(terser@5.39.0)(typescript@5.8.2)(yaml@2.7.1)): dependencies: - astro: 5.5.5(@types/node@22.13.14)(jiti@2.4.2)(lightningcss@1.29.3)(rollup@4.38.0)(terser@5.39.0)(typescript@5.8.2)(yaml@2.7.1) + astro: 5.5.6(@types/node@22.13.14)(jiti@2.4.2)(lightningcss@1.29.3)(rollup@4.38.0)(terser@5.39.0)(typescript@5.8.2)(yaml@2.7.1) canvaskit-wasm: 0.39.1 deterministic-object-hash: 2.0.2 entities: 4.5.0 @@ -5157,7 +5160,7 @@ snapshots: valid-filename: 4.0.0 zod: 3.24.2 - astro@5.5.5(@types/node@22.13.14)(jiti@2.4.2)(lightningcss@1.29.3)(rollup@4.38.0)(terser@5.39.0)(typescript@5.8.2)(yaml@2.7.1): + astro@5.5.6(@types/node@22.13.14)(jiti@2.4.2)(lightningcss@1.29.3)(rollup@4.38.0)(terser@5.39.0)(typescript@5.8.2)(yaml@2.7.1): dependencies: '@astrojs/compiler': 2.11.0 '@astrojs/internal-helpers': 0.6.1 @@ -5678,7 +5681,7 @@ snapshots: dependencies: '@eslint-community/eslint-utils': 4.5.1(eslint@9.23.0(jiti@2.4.2)) '@jridgewell/sourcemap-codec': 1.5.0 - '@typescript-eslint/types': 8.28.0 + '@typescript-eslint/types': 8.29.0 astro-eslint-parser: 1.2.2 eslint: 9.23.0(jiti@2.4.2) eslint-compat-utils: 0.6.4(eslint@9.23.0(jiti@2.4.2)) @@ -5703,7 +5706,7 @@ snapshots: eslint-plugin-import-x@4.9.4(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2): dependencies: '@types/doctrine': 0.0.9 - '@typescript-eslint/utils': 8.28.0(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2) + '@typescript-eslint/utils': 8.29.0(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2) debug: 4.4.0 doctrine: 3.0.0 eslint: 9.23.0(jiti@2.4.2) @@ -5766,8 +5769,8 @@ snapshots: eslint-plugin-perfectionist@4.10.1(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2): dependencies: - '@typescript-eslint/types': 8.28.0 - '@typescript-eslint/utils': 8.28.0(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2) + '@typescript-eslint/types': 8.29.0 + '@typescript-eslint/utils': 8.29.0(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2) eslint: 9.23.0(jiti@2.4.2) natural-orderby: 5.0.0 transitivePeerDependencies: @@ -5825,11 +5828,11 @@ snapshots: semver: 7.7.1 strip-indent: 4.0.0 - eslint-plugin-unused-imports@4.1.4(@typescript-eslint/eslint-plugin@8.28.0(@typescript-eslint/parser@8.28.0(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2))(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2))(eslint@9.23.0(jiti@2.4.2)): + eslint-plugin-unused-imports@4.1.4(@typescript-eslint/eslint-plugin@8.29.0(@typescript-eslint/parser@8.29.0(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2))(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2))(eslint@9.23.0(jiti@2.4.2)): dependencies: eslint: 9.23.0(jiti@2.4.2) optionalDependencies: - '@typescript-eslint/eslint-plugin': 8.28.0(@typescript-eslint/parser@8.28.0(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2))(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2) + '@typescript-eslint/eslint-plugin': 8.29.0(@typescript-eslint/parser@8.29.0(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2))(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.2) eslint-plugin-vue@10.0.0(eslint@9.23.0(jiti@2.4.2))(vue-eslint-parser@10.1.1(eslint@9.23.0(jiti@2.4.2))): dependencies: diff --git a/src/components/Widgets/Scrollbar.astro b/src/components/Widgets/Scrollbar.astro index 15e6870..6702f4c 100644 --- a/src/components/Widgets/Scrollbar.astro +++ b/src/components/Widgets/Scrollbar.astro @@ -16,6 +16,9 @@ function setupScrollbar() { autoHide: 'scroll', autoHideDelay: 800, }, + overflow: { + x: 'hidden', + }, }) bodyElement.setAttribute('data-scrollbar-initialized', 'true') @@ -33,6 +36,9 @@ function setupScrollbar() { autoHide: 'leave', autoHideDelay: 500, }, + overflow: { + y: 'hidden', + }, }) pre.setAttribute('data-scrollbar-initialized', 'true') @@ -50,6 +56,9 @@ function setupScrollbar() { autoHide: 'leave', autoHideDelay: 500, }, + overflow: { + x: 'hidden', + }, }) tocElement.setAttribute('data-scrollbar-initialized', 'true') diff --git a/src/config.ts b/src/config.ts index 3e51dde..8885414 100644 --- a/src/config.ts +++ b/src/config.ts @@ -63,6 +63,8 @@ export const themeConfig: ThemeConfig = { dateFormat: 'YYYY-MM-DD', // YYYY-MM-DD, MM-DD-YYYY, DD-MM-YYYY, MONTH DAY YYYY, DAY MONTH YYYY // gap between title and subtitle titleGap: 2, // 1, 2, 3 + // enable KaTeX for mathematical formulas rendering + katex: true, // true, false }, // GLOBAL SETTINGS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> END diff --git a/src/content/posts/KaTeX Mathematical Demo.md b/src/content/posts/KaTeX Mathematical Demo.md new file mode 100644 index 0000000..5c4323f --- /dev/null +++ b/src/content/posts/KaTeX Mathematical Demo.md @@ -0,0 +1,150 @@ +--- +title: KaTeX Mathematical Demo +published: 2025-04-01 +description: KaTeX is a cross-browser JavaScript library that displays mathematical notation in web browsers. It puts special emphasis on being fast and easy to use. It was initially developed by Khan Academy, and became one of the top five trending projects on GitHub. +--- + +$\KaTeX$ is a cross-browser JavaScript library that displays mathematical notation in web browsers. It puts special emphasis on being fast and easy to use. It was initially developed by Khan Academy, and became one of the top five trending projects on GitHub. + +## Group Theory + +Burnside's lemma, sometimes also called Burnside's counting theorem, the Cauchy-Frobenius lemma or the orbit-counting theorem + +Let $\wedge$ be a group action of a finite group $G$ on a finite set $X$. Then the number $t$ of orbits of the action is given by the formula + +$$ +t=\frac{1}{|G|}\sum_{g\in G}|\text{Fix}(g)| +$$ + +For each integer $n\ge2$, the quotient group $\mathbb{Z}/n\mathbb{Z}$ is a cyclic group generated by $1+n\mathbb{Z}$ and so $\color{red}{\mathbb{Z}/n\mathbb{Z}\cong\mathbb{Z}_n}$ + +The quotient group $\mathbb{R}/\mathbb{Z}$ is isomorphic to $([0,1),+_1)$, the group of real numbers in the interval $[0,1)$, under addition modulo 1. + +Isomorphism Theorem. Let $\phi\colon(G,\circ)\to(H,*)$ be a homomorphism. Then the function + +$$ +\begin{aligned} +f\colon G/\text{Ker}(\phi)&\to\text{Im}(\phi)\\ +x\text{Ker}(\phi)&\mapsto\phi(x) +\end{aligned} +$$ + +is an isomorphism, so + +$$ +G/\text{Ker}(\phi)\cong \text{Im}(\phi) +$$ + +## Taylor's Theorem + +Let the function $f$ be an $(n+1)$-times differentiable on an open interval containing the points $a$ and $x$. Then + +$$ + f(x)=f(a)+f'(a)(x-a)+\cdots+\frac{f^{(n)}(a)}{n!}(x-a)^n+R_n(x) +$$ + +where + +$$ + R_n(x)=\frac{f^{(n+1)}(c)}{(n+1)!}(x-a)^{n+1}, +$$ + +for some $c$ between $a$ and $x$. + +$\KaTeX$ doesn't have a right-align option so an extra aligned column is used for equation numbers. They are pushed to the right by mkern spacing, default \mkern100mu. Both align & align* environments can be used, as can \tag and \notag. + +## Align environment + +$$ +\begin{align} +\frac{\pi}{4n^2} &= \frac{4^n(n!)^2}{2n^2(2n)!}n(2n-1)J_{n-1}-\frac{4^n(n!)^2}{2n^2(2n)!}2n^2J_n \tag{1} \\ +&= \frac{4^n}{4(2n)!}\left(\frac{n!}{n}\right)^22n(2n-1)J_{n-1}-\frac{4^n(n!)^2}{(2n)!}J_n \tag{$\ddagger$} \\ +&= \frac{4^{n-1}((n-1)!)^2}{(2n-2)!}J_{n-1}-\frac{4^n(n!)^2}{(2n)!}J_n \tag{2} +\end{align} +$$ + +## Align* environment + +$$ +\begin{align} +\frac{4^N(N!)^2}{(2N)!}J_N &\leq \frac{4^N(N!)^2}{(2N)!}\frac{\pi^2}{4}\frac{1}{2n+2}I_{2N} \tag{*} \\ +&= \frac{\pi^2}{8(N+1)}\frac{4^N(N!)^2}{(2N)!}I_{2N} \\ +&= \frac{\pi^2}{8(N+1)}\frac{\pi}{2} \tag{**} \\ +&= \frac{\pi^3}{16(N+1)} \\ +\frac{x}{\sin x} &\leq \frac{\pi}{2} \tag{3} \\ +\text{so} \qquad\qquad x &\leq \frac{\pi}{2}\sin x \tag{4} +\end{align} +$$ + +## Sum of a Series + +$$ +\begin{align*} +\sum_{i=1}^{k+1}i &= \left(\sum_{i=1}^{k}i\right) +(k+1) \tag{1} \\ +&= \frac{k(k+1)}{2}+k+1 \tag{2} \\ +&= \frac{k(k+1)+2(k+1)}{2} \tag{3} \\ +&= \frac{(k+1)(k+2)}{2} \tag{4} \\ +&= \frac{(k+1)((k+1)+1)}{2} \tag{5} +\end{align*} +$$ + +## Product notation + +$$ +1 + \frac{q^2}{(1-q)}+\frac{q^6}{(1-q)(1-q^2)}+\cdots += \prod_{j=0}^{\infty}\frac{1}{(1-q^{5j+2})(1-q^{5j+3})}, +\text{ for }\lvert q\rvert < 1. +$$ + +## Cross Product + +$$ +\mathbf{V}_1 \times \mathbf{V}_2 = \begin{vmatrix} +\mathbf{i} & \mathbf{j} & \mathbf{k} \\[1ex] +\frac{\partial X}{\partial u} & \frac{\partial Y}{\partial u} & 0 \\[2.5ex] +\frac{\partial X}{\partial v} & \frac{\partial Y}{\partial v} & 0 +\end{vmatrix} +$$ + +## Maxwell's Equations + +$$ +\begin{align*} +\nabla \times \vec{\mathbf{B}} -\, \frac1c\, \frac{\partial\vec{\mathbf{E}}}{\partial t} &= \frac{4\pi}{c}\vec{\mathbf{j}} \\ +\nabla \cdot \vec{\mathbf{E}} &= 4 \pi \rho \\ +\nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t} &= \vec{\mathbf{0}} \\ +\nabla \cdot \vec{\mathbf{B}} &= 0 +\end{align*} +$$ + +## Greek Letters + +$$ +\begin{align*} +&\Gamma\ \Delta\ \Theta\ \Lambda\ \Xi\ \Pi\ \Sigma\ \Upsilon\ \Phi\ \Psi\ \Omega\\ +&\alpha\ \beta\ \gamma\ \delta\ \epsilon\ \zeta\ \eta\ \theta\ \iota\ \kappa\ \lambda\ \mu\ \nu\ \xi\ \omicron\ \pi\ \rho\ \sigma\ \tau\ \upsilon\ \phi\ \chi\ \psi\ \omega\ \varepsilon\ \vartheta\ \varpi\ \varrho\ \varsigma\ \varphi +\end{align*} +$$ + +## Arrows + +$$ +\begin{align*} +&\gets\ \to\ \leftarrow\ \rightarrow\ \uparrow\ \Uparrow\ \downarrow\ \Downarrow\ \updownarrow\ \Updownarrow\\ +&\Leftarrow\ \Rightarrow\ \leftrightarrow\ \Leftrightarrow\ \mapsto\ \hookleftarrow\\ +&\leftharpoonup\ \leftharpoondown\ \rightleftharpoons\ \longleftarrow\ \Longleftarrow\ \longrightarrow\\ +&\Longrightarrow\ \longleftrightarrow\ \Longleftrightarrow\ \longmapsto\ \hookrightarrow\ \rightharpoonup\\ +&\rightharpoondown\ \leadsto\ \nearrow\ \searrow\ \swarrow\ \nwarrow +\end{align*} +$$ + +## Symbols + +$$ +\begin{align*} +&\surd\ \barwedge\ \veebar\ \odot\ \oplus\ \otimes\ \oslash\ \circledcirc\ \boxdot\ \bigtriangleup\\ +&\bigtriangledown\ \dagger\ \diamond\ \star\ \triangleleft\ \triangleright\ \angle\ \infty\ \prime\ \triangle +\end{align*} +$$ + +*Samples taken from [KaTeX Live Demo](https://sixthform.info/katex/examples/demo.html)* diff --git a/src/content/posts/guides/Theme Guide-en.md b/src/content/posts/guides/Theme Guide-en.md index f92103a..3c95c0d 100644 --- a/src/content/posts/guides/Theme Guide-en.md +++ b/src/content/posts/guides/Theme Guide-en.md @@ -84,6 +84,8 @@ global: { dateFormat: 'YYYY-MM-DD' // YYYY-MM-DD, MM-DD-YYYY, DD-MM-YYYY, MONTH DAY YYYY, DAY MONTH YYYY // gap between title and subtitle titleGap: 2 // 1, 2, 3 + // enable KaTeX for mathematical formulas rendering + katex: true // true, false } ``` diff --git a/src/content/posts/guides/Theme Guide-es.md b/src/content/posts/guides/Theme Guide-es.md index 4637497..8d0a57d 100644 --- a/src/content/posts/guides/Theme Guide-es.md +++ b/src/content/posts/guides/Theme Guide-es.md @@ -84,6 +84,8 @@ global: { dateFormat: 'YYYY-MM-DD' // YYYY-MM-DD, MM-DD-YYYY, DD-MM-YYYY, MONTH DAY YYYY, DAY MONTH YYYY // espacio entre título y subtítulo titleGap: 2 // 1, 2, 3 + // habilitar KaTeX para renderizar fórmulas matemáticas + katex: true // true, false } ``` diff --git a/src/content/posts/guides/Theme Guide-ja.md b/src/content/posts/guides/Theme Guide-ja.md index b4e3d70..5762361 100644 --- a/src/content/posts/guides/Theme Guide-ja.md +++ b/src/content/posts/guides/Theme Guide-ja.md @@ -56,7 +56,7 @@ color: { // ダークモード dark: { // プライマリカラー - // タイトル、ホバーなどに使用 + // サイトタイトル、ホバー効果などに使用 primary: 'oklch(92% 0.005 298)' // セカンダリカラー // 通常テキストに使用 @@ -84,6 +84,8 @@ global: { dateFormat: 'YYYY-MM-DD' // YYYY-MM-DD, MM-DD-YYYY, DD-MM-YYYY, MONTH DAY YYYY, DAY MONTH YYYY // タイトルとサブタイトルの間隔 titleGap: 2 // 1, 2, 3 + // 数式表示のためのKaTeXを有効化 + katex: true // true, false } ``` diff --git a/src/content/posts/guides/Theme Guide-ru.md b/src/content/posts/guides/Theme Guide-ru.md index d2c74b6..e45cb7d 100644 --- a/src/content/posts/guides/Theme Guide-ru.md +++ b/src/content/posts/guides/Theme Guide-ru.md @@ -84,6 +84,8 @@ global: { dateFormat: 'YYYY-MM-DD' // YYYY-MM-DD, MM-DD-YYYY, DD-MM-YYYY, MONTH DAY YYYY, DAY MONTH YYYY // промежуток между заголовком и подзаголовком titleGap: 2 // 1, 2, 3 + // включить KaTeX для отображения математических формул + katex: true // true, false } ``` @@ -192,7 +194,6 @@ preload: { customUmamiAnalyticsJS: 'https://js.radishzz.cc/jquery.min.js' } ``` - ## Создание Новой Статьи Создайте новый файл с расширением `.md` или `.mdx` в директории `src/content/posts/` и добавьте метаданные Front Matter в верхней части файла. diff --git a/src/content/posts/guides/Theme Guide-zh-tw.md b/src/content/posts/guides/Theme Guide-zh-tw.md index 1637944..3c1fba1 100644 --- a/src/content/posts/guides/Theme Guide-zh-tw.md +++ b/src/content/posts/guides/Theme Guide-zh-tw.md @@ -56,7 +56,7 @@ color: { // 暗色模式 dark: { // 高亮顏色 - // 用於標題、hover等 + // 用於站點標題、滑鼠懸停效果等 primary: 'oklch(92% 0.005 298)' // 次要顏色 // 用於普通文本 @@ -84,6 +84,8 @@ global: { dateFormat: 'YYYY-MM-DD' // YYYY-MM-DD, MM-DD-YYYY, DD-MM-YYYY, MONTH DAY YYYY, DAY MONTH YYYY // 標題與副標題之間的距離 titleGap: 2 // 1, 2, 3 + // 啟用 KaTeX 數學公式渲染 + katex: true // true, false } ``` diff --git a/src/content/posts/guides/Theme Guide-zh.md b/src/content/posts/guides/Theme Guide-zh.md index bf07815..463b970 100644 --- a/src/content/posts/guides/Theme Guide-zh.md +++ b/src/content/posts/guides/Theme Guide-zh.md @@ -56,7 +56,7 @@ color: { // 暗色模式 dark: { // 高亮颜色 - // 用于标题、hover等 + // 用于站点标题、鼠标悬停效果等 primary: 'oklch(92% 0.005 298)' // 次要颜色 // 用于普通文本 @@ -84,6 +84,8 @@ global: { dateFormat: 'YYYY-MM-DD' // YYYY-MM-DD, MM-DD-YYYY, DD-MM-YYYY, MONTH DAY YYYY, DAY MONTH YYYY // 标题与副标题之间的距离 titleGap: 2 // 1, 2, 3 + // 启用 KaTeX 数学公式渲染 + katex: true // true, false } ``` diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro index 47b2418..a385986 100644 --- a/src/layouts/Layout.astro +++ b/src/layouts/Layout.astro @@ -11,6 +11,10 @@ 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 diff --git a/src/types/index.d.ts b/src/types/index.d.ts index df32b20..a227bd8 100644 --- a/src/types/index.d.ts +++ b/src/types/index.d.ts @@ -34,6 +34,7 @@ export interface ThemeConfig { fontStyle: 'sans' | 'serif' dateFormat: 'YYYY-MM-DD' | 'MM-DD-YYYY' | 'DD-MM-YYYY' | 'MONTH DAY YYYY' | 'DAY MONTH YYYY' titleGap: 1 | 2 | 3 + katex: boolean } comment: {