From 018f1c9b6c662b8d409bdf01fdac88701d069d59 Mon Sep 17 00:00:00 2001 From: radishzzz Date: Tue, 15 Apr 2025 16:53:29 +0100 Subject: [PATCH] chore: improve article auto-excerpt, allow inline code to wrap --- package.json | 2 +- pnpm-lock.yaml | 221 +++++++++++++++--- .../posts/diaries/Birth of Retypeset-zh.md | 2 +- 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 | 2 +- src/content/posts/guides/Theme Guide-zh-tw.md | 4 +- src/content/posts/guides/Theme Guide-zh.md | 4 +- src/styles/heti.css | 4 +- src/utils/description.ts | 41 +++- 11 files changed, 230 insertions(+), 58 deletions(-) diff --git a/package.json b/package.json index dd4bd52..b21d233 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "@astrojs/rss": "^4.0.11", "@astrojs/sitemap": "^3.3.0", "@waline/client": "^3.5.6", - "astro": "^5.6.2", + "astro": "^5.7.0", "astro-compress": "^2.3.8", "astro-og-canvas": "^0.7.0", "astro-robots-txt": "^1.0.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6fc481a..44f01e3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -10,7 +10,7 @@ importers: dependencies: '@astrojs/mdx': specifier: ^4.2.4 - version: 4.2.4(astro@5.6.2(@types/node@22.14.1)(jiti@2.4.2)(lightningcss@1.29.3)(rollup@4.40.0)(terser@5.39.0)(typescript@5.8.3)(yaml@2.7.1)) + version: 4.2.4(astro@5.7.0(@types/node@22.14.1)(jiti@2.4.2)(lightningcss@1.29.3)(rollup@4.40.0)(terser@5.39.0)(typescript@5.8.3)(yaml@2.7.1)) '@astrojs/partytown': specifier: ^2.1.4 version: 2.1.4 @@ -24,14 +24,14 @@ importers: specifier: ^3.5.6 version: 3.5.6(typescript@5.8.3) astro: - specifier: ^5.6.2 - version: 5.6.2(@types/node@22.14.1)(jiti@2.4.2)(lightningcss@1.29.3)(rollup@4.40.0)(terser@5.39.0)(typescript@5.8.3)(yaml@2.7.1) + specifier: ^5.7.0 + version: 5.7.0(@types/node@22.14.1)(jiti@2.4.2)(lightningcss@1.29.3)(rollup@4.40.0)(terser@5.39.0)(typescript@5.8.3)(yaml@2.7.1) astro-compress: specifier: ^2.3.8 version: 2.3.8(@types/node@22.14.1)(jiti@2.4.2)(rollup@4.40.0)(typescript@5.8.3)(yaml@2.7.1) astro-og-canvas: specifier: ^0.7.0 - version: 0.7.0(astro@5.6.2(@types/node@22.14.1)(jiti@2.4.2)(lightningcss@1.29.3)(rollup@4.40.0)(terser@5.39.0)(typescript@5.8.3)(yaml@2.7.1)) + version: 0.7.0(astro@5.7.0(@types/node@22.14.1)(jiti@2.4.2)(lightningcss@1.29.3)(rollup@4.40.0)(terser@5.39.0)(typescript@5.8.3)(yaml@2.7.1)) astro-robots-txt: specifier: ^1.0.0 version: 1.0.0 @@ -256,6 +256,12 @@ packages: resolution: {integrity: sha512-H45s8fVLYjbhFH62dIJ3WtmJ6RSPt/3DRO0ZcT2SUiYiQyz3BLVb9ADEnLl91m74aQPS3AzzeajZHYOalWe3bg==} engines: {node: '>=6.9.0'} + '@capsizecss/metrics@3.5.0': + resolution: {integrity: sha512-Ju2I/Qn3c1OaU8FgeW4Tc22D4C9NwyVfKzNmzst59bvxBjPoLYNZMqFYn+HvCtn4MpXwiaDtCE8fNuQLpdi9yA==} + + '@capsizecss/unpack@2.4.0': + resolution: {integrity: sha512-GrSU71meACqcmIUxPYOJvGKF0yryjN/L1aCuE9DViCTJI7bfkjgYDPD1zbNDcINJwSSP6UaBZY9GAbYDO7re0Q==} + '@clack/core@0.4.2': resolution: {integrity: sha512-NYQfcEy8MWIxrT5Fj8nIVchfRFA26yYKJcvBS7WlUIlw2OmQOY9DhGGXMovyI5J5PpxrCPGkgUi207EBrjpBvg==} @@ -802,8 +808,8 @@ packages: resolution: {integrity: sha512-fdDH1LSGfZdTH2sxdpVMw31BanV28K/Gry0cVFxaNP77neJSkd82mM8ErPNYs9e+0O7SdHBLTDzDgwUuy18RnQ==} engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0} - '@pkgr/core@0.2.3': - resolution: {integrity: sha512-yMV8bb9prWI21N6FsrnPCbhoYb8UUvYCDGoSvPHBloVC095Ef2ker43hzXkJ6TpJPw53S8FeFYkARa7GGIGwxg==} + '@pkgr/core@0.2.4': + resolution: {integrity: sha512-ROFF39F6ZrnzSUEmQQZUar0Jt4xVoP9WnDRdWwF4NNcXs3xBTLgBUDoOwW141y1jP+S8nahIbdxbFC7IShw9Iw==} engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0} '@playform/pipe@0.1.3': @@ -957,6 +963,9 @@ packages: peerDependencies: eslint: '>=9.0.0' + '@swc/helpers@0.5.17': + resolution: {integrity: sha512-5IKx/Y13RsYd+sauPb2x+U/xZikHjolzfuDgTAl/Tdf3Q8rslRvC19NKDLgAJQ6wsqADk10ntlv08nPFw/gO/A==} + '@trysound/sax@0.2.0': resolution: {integrity: sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA==} engines: {node: '>=10.13.0'} @@ -1479,8 +1488,8 @@ packages: astro-robots-txt@1.0.0: resolution: {integrity: sha512-6JQSLid4gMhoWjOm85UHLkgrw0+hHIjnJVIUqxjU2D6feKlVyYukMNYjH44ZDZBK1P8hNxd33PgWlHzCASvedA==} - astro@5.6.2: - resolution: {integrity: sha512-Ds4x3Au2s+YfBKLXY2HCHird+73ff4wTds+cuAGqaHmY4GR+Gc+sCAP54Mq6blkpuFqXwqjPUAcmxvAwovJPGQ==} + astro@5.7.0: + resolution: {integrity: sha512-LxvWFlCQSxRLqvtCfZ/LFzlaHcvX++qtq0NrRmwtDmrZhAyHOoVfLkxEE0STKgn0wjLTuETyBrgCBWe2eb68/A==} engines: {node: ^18.17.1 || ^20.3.0 || >=22.0.0, npm: '>=9.6.5', pnpm: '>=7.1.0'} hasBin: true @@ -1506,10 +1515,16 @@ packages: base-64@1.0.0: resolution: {integrity: sha512-kwDPIFCGx0NZHog36dj+tHiwP4QMzsZ3AgMViUBKI0+V5n4U0ufTCUMhnQ04diaRI8EX/QcPfql7zlhZ7j4zgg==} + base64-js@1.5.1: + resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} + binary-extensions@2.3.0: resolution: {integrity: sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==} engines: {node: '>=8'} + blob-to-buffer@1.2.9: + resolution: {integrity: sha512-BF033y5fN6OCofD3vgHmNtwZWRcq9NLyyxyILx9hfMy1sXYy4ojFl765hJ2lP0YaN2fuxPaLO2Vzzoxy0FLFFA==} + boolbase@1.0.0: resolution: {integrity: sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==} @@ -1527,6 +1542,9 @@ packages: resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==} engines: {node: '>=8'} + brotli@1.3.3: + resolution: {integrity: sha512-oTKjJdShmDuGW94SyyaoQvAjf30dZaHnjJ8uAF+u2/vGJkJbJPJAT1gDiOJP5v1Zb6f9KEyW/1HpuaWIXtGHPg==} + browserslist@4.24.4: resolution: {integrity: sha512-KDi1Ny1gSePi1vm0q4oxSF8b4DR44GF4BbmS2YdhPLOEqd8pDviZOGH/GsmRwoWJ2+5Lr085X7naowMwKHDG1A==} engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} @@ -1630,6 +1648,10 @@ packages: resolution: {integrity: sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==} engines: {node: '>=12'} + clone@2.1.2: + resolution: {integrity: sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w==} + engines: {node: '>=0.8'} + clsx@2.1.1: resolution: {integrity: sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==} engines: {node: '>=6'} @@ -1706,6 +1728,9 @@ packages: core-js-compat@3.41.0: resolution: {integrity: sha512-RFsU9LySVue9RTwdDVX/T0e2Y6jRYWXERKElIjpuEOEnxaXffI0X7RUwVzfYLfzuLXSNJDYoRYUAmRUcyln20A==} + cross-fetch@3.2.0: + resolution: {integrity: sha512-Q+xVJLoGOeIMXZmbUK4HYk+69cQH6LudR0Vu/pRm2YlU/hDV9CiS0gKUMaWY5f2NeUH9C1nV3bsTlCo0FsTV1Q==} + cross-spawn@7.0.6: resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==} engines: {node: '>= 8'} @@ -1803,6 +1828,9 @@ packages: devlop@1.1.0: resolution: {integrity: sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==} + dfa@1.2.0: + resolution: {integrity: sha512-ED3jP8saaweFTjeGX8HQPjeC1YYyZs98jGNZx6IiBvxW7JG5v492kamAQB3m2wop07CvU/RQmzcKr6bgcC5D/Q==} + diff@5.2.0: resolution: {integrity: sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A==} engines: {node: '>=0.3.1'} @@ -1963,8 +1991,8 @@ packages: peerDependencies: eslint: '>=8' - eslint-plugin-import-x@4.10.3: - resolution: {integrity: sha512-Q7yx76tlOfzLGtXDt/sppdYrGNcbr9CrRXqJXTNIpM/7hfX9lRp1noE+PkYgN+xvW47TEeGZ0pgy29hlX9Y7UQ==} + eslint-plugin-import-x@4.10.5: + resolution: {integrity: sha512-cmteCl8P5q1lkuL/4qqQw1uvnQHytpv2fjHFZ2UIqSfkM0RwWm/KLgasXKIqDRjgMnmUJTeyP8+9hDpJJuiZgg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.57.0 || ^9.0.0 @@ -2197,6 +2225,9 @@ packages: resolution: {integrity: sha512-9UbaD6XdAL97+k/n+N7JwX46K/M6Zc6KcFYskrYL8wbBV/Uyk0CTAMY0VT+qiK5PM7AIc9aTWYtq65U7T+aCNQ==} engines: {node: '>=8'} + fontkit@2.0.4: + resolution: {integrity: sha512-syetQadaUEDNdxdugga9CpEYVaQIxOwk7GlwZWWZ19//qW4zE5bknOKeMBDYAASwnpaSHKJITRLMF9m1fp3s6g==} + fsevents@2.3.3: resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} @@ -2902,6 +2933,15 @@ packages: node-fetch-native@1.6.6: resolution: {integrity: sha512-8Mc2HhqPdlIfedsuZoc3yioPuzp6b+L5jRCRY1QzuWZh2EGJVQrGppC6V6cF0bLdbW0+O2YpqCA25aF/1lvipQ==} + node-fetch@2.7.0: + resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==} + engines: {node: 4.x || >=6.0.0} + peerDependencies: + encoding: ^0.1.0 + peerDependenciesMeta: + encoding: + optional: true + node-mock-http@1.0.0: resolution: {integrity: sha512-0uGYQ1WQL1M5kKvGRXWQ3uZCHtLTO8hln3oBjIusM75WoesZ909uQJs/Hb946i2SS+Gsrhkaa6iAO17jRIv6DQ==} @@ -2926,6 +2966,9 @@ packages: ofetch@1.4.1: resolution: {integrity: sha512-QZj2DfGplQAr2oj9KzceK9Hwz6Whxazmn85yYeVuS3u9XTMOGMRx0kO95MQ+vLsj/S/NwBDMMLU5hpxvI6Tklw==} + ohash@1.1.6: + resolution: {integrity: sha512-TBu7PtV8YkAZn0tSxobKY2n2aAQva936lhRrj6957aDaCf9IEtqsKbgMzXE/F/sjqYOwmrukeORHNLe5glk7Cg==} + onetime@6.0.0: resolution: {integrity: sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==} engines: {node: '>=12'} @@ -2970,8 +3013,11 @@ packages: package-manager-detector@0.2.11: resolution: {integrity: sha512-BEnLolu+yuz22S56CU1SUKq3XC3PkwD5wv4ikR4MfGvnRVcmzXR9DwSlW2fEamyTPyXHomBJRzgapeuBvRNzJQ==} - package-manager-detector@1.1.0: - resolution: {integrity: sha512-Y8f9qUlBzW8qauJjd/eu6jlpJZsuPJm2ZAV0cDVd420o4EdpH5RPdoCv+60/TdJflGatr4sDfpAL6ArWZbM5tA==} + package-manager-detector@1.2.0: + resolution: {integrity: sha512-PutJepsOtsqVfUsxCzgTTpyXmiAgvKptIgY4th5eq5UXXFhj5PxfQ9hnGkypMeovpAvVshFRItoFHYO18TCOqA==} + + pako@0.2.9: + resolution: {integrity: sha512-NUcwaKxUxWrZLpDG+z/xZaCgQITkA/Dv4V/T6bw7VON6l1Xz/VnrBqrYjZQ12TamKHzITTfOEIYUj48y2KXImA==} param-case@3.0.4: resolution: {integrity: sha512-RXlj7zCYokReqWpOPH9oYivUzLYZ5vAPIfEmCTNViosC78F8F0H9y7T7gG2M39ymgutxF5gcFEsyZQSph9Bp3A==} @@ -3259,6 +3305,9 @@ packages: resolution: {integrity: sha512-oMA2dcrw6u0YfxJQXm342bFKX/E4sG9rbTzO9ptUcR/e8A33cHuvStiYOwH7fszkZlZ1z/ta9AAoPk2F4qIOHA==} engines: {node: '>=18'} + restructure@3.0.2: + resolution: {integrity: sha512-gSfoiOEA0VPE6Tukkrr7I0RBdE0s7H1eFCDBk05l1KIQT1UIKNc5JZy6jdyW6eYH3aR3g5b3PuL77rq0hvwtAw==} + retext-latin@4.0.0: resolution: {integrity: sha512-hv9woG7Fy0M9IlRQloq/N6atV82NxLGveq+3H2WOi79dtIYWN8OaxogDm77f8YnVXJL2VD3bbqowu5E3EMhBYA==} @@ -3480,6 +3529,9 @@ packages: engines: {node: '>=10'} hasBin: true + tiny-inflate@1.0.3: + resolution: {integrity: sha512-pkY1fj1cKHb2seWDy0B16HeWyczlJA9/WW3u3c4z/NiWDsO3DOU5D7nhTLE9CF0yXv/QZFY7sEJmj24dK+Rrqw==} + tinybench@2.9.0: resolution: {integrity: sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==} @@ -3514,6 +3566,9 @@ packages: resolution: {integrity: sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ==} engines: {node: '>=6'} + tr46@0.0.3: + resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} + trim-lines@3.0.1: resolution: {integrity: sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==} @@ -3543,8 +3598,8 @@ packages: resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==} engines: {node: '>= 0.8.0'} - type-fest@4.39.1: - resolution: {integrity: sha512-uW9qzd66uyHYxwyVBYiwS4Oi0qZyUqwjU+Oevr6ZogYiXt99EOYtwvzMSLw1c3lYo2HzJsep/NB23iEVEgjG/w==} + type-fest@4.40.0: + resolution: {integrity: sha512-ABHZ2/tS2JkvH1PEjxFDTUWC8dB5OsIGZP4IFLhR293GqT5Y5qB1WwL2kMPYhQW9DVgVD8Hd7I8gjwPIf5GFkw==} engines: {node: '>=16'} typesafe-path@0.2.2: @@ -3579,6 +3634,12 @@ packages: undici-types@6.21.0: resolution: {integrity: sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==} + unicode-properties@1.4.1: + resolution: {integrity: sha512-CLjCCLQ6UuMxWnbIylkisbRj31qxHPAurvena/0iwSVbQ2G1VY5/HjV0IRabOEbDHlzZlRdCrD4NhB0JtU40Pg==} + + unicode-trie@2.0.0: + resolution: {integrity: sha512-x7bc76x0bm4prf1VLg79uhAzKw8DVboClSN5VxJuQ+LKDOVEW9CdH+VY7SP+vX7xCYQqzzgQpFqz15zeLvAtZQ==} + unicorn-magic@0.1.0: resolution: {integrity: sha512-lRfVq8fE8gz6QMBuDM6a+LO3IAzTi05H6gCVaUpir2E1Rwpo4ZUog45KpNXKC/Mn3Yb9UDuHumeFTo9iV/D9FQ==} engines: {node: '>=18'} @@ -3586,6 +3647,9 @@ packages: unified@11.0.5: resolution: {integrity: sha512-xKvGhPWw3k84Qjh8bI3ZeJjqnyadK+GEFtazSfZv/rKeTkTjOJho6mFqh2SM96iIcZokxiOpg78GazTSg8+KHA==} + unifont@0.1.7: + resolution: {integrity: sha512-UyN6r/TUyl69iW/jhXaCtuwA6bP9ZSLhVViwgP8LH9EHRGk5FyIMDxvClqD5z2BV6MI9GMATzd0dyLqFxKkUmQ==} + unist-util-find-after@5.0.0: resolution: {integrity: sha512-amQa0Ep2m6hE2g72AugUItjbuM8X8cGQnFoHk0pGfrFeT9GZhzN5SW8nRsiGKK7Aif4CrACPENkA6P/Lw6fHGQ==} @@ -3936,6 +4000,12 @@ packages: web-namespaces@2.0.1: resolution: {integrity: sha512-bKr1DkiNa2krS7qxNtdrtHAmzuYGFQLiQ13TsorsdT6ULTkPLKuu5+GsFpDlg6JFjUTwX2DyhMPG2be8uPrqsQ==} + webidl-conversions@3.0.1: + resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==} + + whatwg-url@5.0.0: + resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==} + which-pm-runs@1.1.0: resolution: {integrity: sha512-n1brCuqClxfFfq/Rb0ICg9giSZqCS+pLtccdag6C2HyufBrh3fBOiy9nb6ggRMvWOVH5GrdJskj5iGTZNxd7SA==} engines: {node: '>=4'} @@ -4060,7 +4130,7 @@ snapshots: eslint-merge-processors: 2.0.0(eslint@9.24.0(jiti@2.4.2)) eslint-plugin-antfu: 3.1.1(eslint@9.24.0(jiti@2.4.2)) eslint-plugin-command: 3.2.0(eslint@9.24.0(jiti@2.4.2)) - eslint-plugin-import-x: 4.10.3(eslint@9.24.0(jiti@2.4.2))(typescript@5.8.3) + eslint-plugin-import-x: 4.10.5(eslint@9.24.0(jiti@2.4.2))(typescript@5.8.3) eslint-plugin-jsdoc: 50.6.9(eslint@9.24.0(jiti@2.4.2)) eslint-plugin-jsonc: 2.20.0(eslint@9.24.0(jiti@2.4.2)) eslint-plugin-n: 17.17.0(eslint@9.24.0(jiti@2.4.2)) @@ -4164,12 +4234,12 @@ snapshots: transitivePeerDependencies: - supports-color - '@astrojs/mdx@4.2.4(astro@5.6.2(@types/node@22.14.1)(jiti@2.4.2)(lightningcss@1.29.3)(rollup@4.40.0)(terser@5.39.0)(typescript@5.8.3)(yaml@2.7.1))': + '@astrojs/mdx@4.2.4(astro@5.7.0(@types/node@22.14.1)(jiti@2.4.2)(lightningcss@1.29.3)(rollup@4.40.0)(terser@5.39.0)(typescript@5.8.3)(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.6.2(@types/node@22.14.1)(jiti@2.4.2)(lightningcss@1.29.3)(rollup@4.40.0)(terser@5.39.0)(typescript@5.8.3)(yaml@2.7.1) + astro: 5.7.0(@types/node@22.14.1)(jiti@2.4.2)(lightningcss@1.29.3)(rollup@4.40.0)(terser@5.39.0)(typescript@5.8.3)(yaml@2.7.1) es-module-lexer: 1.6.0 estree-util-visit: 2.0.0 hast-util-to-html: 9.0.5 @@ -4238,6 +4308,16 @@ snapshots: '@babel/helper-string-parser': 7.25.9 '@babel/helper-validator-identifier': 7.25.9 + '@capsizecss/metrics@3.5.0': {} + + '@capsizecss/unpack@2.4.0': + dependencies: + blob-to-buffer: 1.2.9 + cross-fetch: 3.2.0 + fontkit: 2.0.4 + transitivePeerDependencies: + - encoding + '@clack/core@0.4.2': dependencies: picocolors: 1.1.1 @@ -4706,7 +4786,7 @@ snapshots: '@pkgr/core@0.1.2': {} - '@pkgr/core@0.2.3': {} + '@pkgr/core@0.2.4': {} '@playform/pipe@0.1.3': dependencies: @@ -4837,6 +4917,10 @@ snapshots: - supports-color - typescript + '@swc/helpers@0.5.17': + dependencies: + tslib: 2.8.1 + '@trysound/sax@0.2.0': {} '@tybys/wasm-util@0.9.0': @@ -5470,7 +5554,7 @@ snapshots: '@playform/pipe': 0.1.3 '@types/csso': 5.0.4 '@types/html-minifier-terser': 7.0.2 - astro: 5.6.2(@types/node@22.14.1)(jiti@2.4.2)(lightningcss@1.29.3)(rollup@4.40.0)(terser@5.39.0)(typescript@5.8.3)(yaml@2.7.1) + astro: 5.7.0(@types/node@22.14.1)(jiti@2.4.2)(lightningcss@1.29.3)(rollup@4.40.0)(terser@5.39.0)(typescript@5.8.3)(yaml@2.7.1) commander: 13.1.0 csso: 5.0.5 deepmerge-ts: 7.1.5 @@ -5498,6 +5582,7 @@ snapshots: - '@vercel/kv' - aws4fetch - db0 + - encoding - idb-keyval - ioredis - jiti @@ -5530,9 +5615,9 @@ snapshots: transitivePeerDependencies: - supports-color - astro-og-canvas@0.7.0(astro@5.6.2(@types/node@22.14.1)(jiti@2.4.2)(lightningcss@1.29.3)(rollup@4.40.0)(terser@5.39.0)(typescript@5.8.3)(yaml@2.7.1)): + astro-og-canvas@0.7.0(astro@5.7.0(@types/node@22.14.1)(jiti@2.4.2)(lightningcss@1.29.3)(rollup@4.40.0)(terser@5.39.0)(typescript@5.8.3)(yaml@2.7.1)): dependencies: - astro: 5.6.2(@types/node@22.14.1)(jiti@2.4.2)(lightningcss@1.29.3)(rollup@4.40.0)(terser@5.39.0)(typescript@5.8.3)(yaml@2.7.1) + astro: 5.7.0(@types/node@22.14.1)(jiti@2.4.2)(lightningcss@1.29.3)(rollup@4.40.0)(terser@5.39.0)(typescript@5.8.3)(yaml@2.7.1) canvaskit-wasm: 0.39.1 deterministic-object-hash: 2.0.2 entities: 4.5.0 @@ -5542,12 +5627,14 @@ snapshots: valid-filename: 4.0.0 zod: 3.24.2 - astro@5.6.2(@types/node@22.14.1)(jiti@2.4.2)(lightningcss@1.29.3)(rollup@4.40.0)(terser@5.39.0)(typescript@5.8.3)(yaml@2.7.1): + astro@5.7.0(@types/node@22.14.1)(jiti@2.4.2)(lightningcss@1.29.3)(rollup@4.40.0)(terser@5.39.0)(typescript@5.8.3)(yaml@2.7.1): dependencies: '@astrojs/compiler': 2.11.0 '@astrojs/internal-helpers': 0.6.1 '@astrojs/markdown-remark': 6.3.1 '@astrojs/telemetry': 3.2.0 + '@capsizecss/metrics': 3.5.0 + '@capsizecss/unpack': 2.4.0 '@oslojs/encoding': 1.1.0 '@rollup/pluginutils': 5.1.4(rollup@4.40.0) acorn: 8.14.1 @@ -5580,7 +5667,7 @@ snapshots: neotraverse: 0.6.18 p-limit: 6.2.0 p-queue: 8.1.0 - package-manager-detector: 1.1.0 + package-manager-detector: 1.2.0 picomatch: 4.0.2 prompts: 2.4.2 rehype: 13.0.2 @@ -5590,6 +5677,7 @@ snapshots: tinyglobby: 0.2.12 tsconfck: 3.1.5(typescript@5.8.3) ultrahtml: 1.6.0 + unifont: 0.1.7 unist-util-visit: 5.0.0 unstorage: 1.15.0 vfile: 6.0.3 @@ -5620,6 +5708,7 @@ snapshots: - '@vercel/kv' - aws4fetch - db0 + - encoding - idb-keyval - ioredis - jiti @@ -5652,8 +5741,12 @@ snapshots: base-64@1.0.0: {} + base64-js@1.5.1: {} + binary-extensions@2.3.0: {} + blob-to-buffer@1.2.9: {} + boolbase@1.0.0: {} boxen@8.0.1: @@ -5663,7 +5756,7 @@ snapshots: chalk: 5.4.1 cli-boxes: 3.0.0 string-width: 7.2.0 - type-fest: 4.39.1 + type-fest: 4.40.0 widest-line: 5.0.0 wrap-ansi: 9.0.0 @@ -5680,6 +5773,10 @@ snapshots: dependencies: fill-range: 7.1.1 + brotli@1.3.3: + dependencies: + base64-js: 1.5.1 + browserslist@4.24.4: dependencies: caniuse-lite: 1.0.30001713 @@ -5782,6 +5879,8 @@ snapshots: strip-ansi: 6.0.1 wrap-ansi: 7.0.0 + clone@2.1.2: {} + clsx@2.1.1: {} collapse-white-space@2.1.0: {} @@ -5836,6 +5935,12 @@ snapshots: dependencies: browserslist: 4.24.4 + cross-fetch@3.2.0: + dependencies: + node-fetch: 2.7.0 + transitivePeerDependencies: + - encoding + cross-spawn@7.0.6: dependencies: path-key: 3.1.1 @@ -5917,6 +6022,8 @@ snapshots: dependencies: dequal: 2.0.3 + dfa@1.2.0: {} + diff@5.2.0: {} dlv@1.1.3: {} @@ -6097,9 +6204,9 @@ snapshots: eslint: 9.24.0(jiti@2.4.2) eslint-compat-utils: 0.5.1(eslint@9.24.0(jiti@2.4.2)) - eslint-plugin-import-x@4.10.3(eslint@9.24.0(jiti@2.4.2))(typescript@5.8.3): + eslint-plugin-import-x@4.10.5(eslint@9.24.0(jiti@2.4.2))(typescript@5.8.3): dependencies: - '@pkgr/core': 0.2.3 + '@pkgr/core': 0.2.4 '@types/doctrine': 0.0.9 '@typescript-eslint/utils': 8.30.1(eslint@9.24.0(jiti@2.4.2))(typescript@5.8.3) debug: 4.4.0 @@ -6441,6 +6548,18 @@ snapshots: flattie@1.1.1: {} + fontkit@2.0.4: + dependencies: + '@swc/helpers': 0.5.17 + brotli: 1.3.3 + clone: 2.1.2 + dfa: 1.2.0 + fast-deep-equal: 3.1.3 + restructure: 3.0.2 + tiny-inflate: 1.0.3 + unicode-properties: 1.4.1 + unicode-trie: 2.0.0 + fsevents@2.3.3: optional: true @@ -7466,6 +7585,10 @@ snapshots: node-fetch-native@1.6.6: {} + node-fetch@2.7.0: + dependencies: + whatwg-url: 5.0.0 + node-mock-http@1.0.0: {} node-releases@2.0.19: {} @@ -7492,6 +7615,8 @@ snapshots: node-fetch-native: 1.6.6 ufo: 1.6.1 + ohash@1.1.6: {} + onetime@6.0.0: dependencies: mimic-fn: 4.0.0 @@ -7543,7 +7668,9 @@ snapshots: dependencies: quansync: 0.2.10 - package-manager-detector@1.1.0: {} + package-manager-detector@1.2.0: {} + + pako@0.2.9: {} param-case@3.0.4: dependencies: @@ -7575,7 +7702,7 @@ snapshots: dependencies: '@babel/code-frame': 7.26.2 index-to-position: 1.1.0 - type-fest: 4.39.1 + type-fest: 4.40.0 parse-latin@7.0.0: dependencies: @@ -7687,14 +7814,14 @@ snapshots: dependencies: find-up-simple: 1.0.1 read-pkg: 9.0.1 - type-fest: 4.39.1 + type-fest: 4.40.0 read-pkg@9.0.1: dependencies: '@types/normalize-package-data': 2.4.4 normalize-package-data: 6.0.2 parse-json: 8.3.0 - type-fest: 4.39.1 + type-fest: 4.40.0 unicorn-magic: 0.1.0 readdirp@3.6.0: @@ -7904,6 +8031,8 @@ snapshots: onetime: 7.0.0 signal-exit: 4.1.0 + restructure@3.0.2: {} + retext-latin@4.0.0: dependencies: '@types/nlcst': 2.0.3 @@ -8192,12 +8321,12 @@ snapshots: synckit@0.10.3: dependencies: - '@pkgr/core': 0.2.3 + '@pkgr/core': 0.2.4 tslib: 2.8.1 synckit@0.11.4: dependencies: - '@pkgr/core': 0.2.3 + '@pkgr/core': 0.2.4 tslib: 2.8.1 synckit@0.9.2: @@ -8214,6 +8343,8 @@ snapshots: commander: 2.20.3 source-map-support: 0.5.21 + tiny-inflate@1.0.3: {} + tinybench@2.9.0: {} tinyexec@0.3.2: {} @@ -8239,6 +8370,8 @@ snapshots: totalist@3.0.1: {} + tr46@0.0.3: {} + trim-lines@3.0.1: {} trough@2.2.0: {} @@ -8257,7 +8390,7 @@ snapshots: dependencies: prelude-ls: 1.2.1 - type-fest@4.39.1: {} + type-fest@4.40.0: {} typesafe-path@0.2.2: {} @@ -8286,6 +8419,16 @@ snapshots: undici-types@6.21.0: {} + unicode-properties@1.4.1: + dependencies: + base64-js: 1.5.1 + unicode-trie: 2.0.0 + + unicode-trie@2.0.0: + dependencies: + pako: 0.2.9 + tiny-inflate: 1.0.3 + unicorn-magic@0.1.0: {} unified@11.0.5: @@ -8298,6 +8441,11 @@ snapshots: trough: 2.2.0 vfile: 6.0.3 + unifont@0.1.7: + dependencies: + css-tree: 3.1.0 + ohash: 1.1.6 + unist-util-find-after@5.0.0: dependencies: '@types/unist': 3.0.3 @@ -8663,6 +8811,13 @@ snapshots: web-namespaces@2.0.1: {} + webidl-conversions@3.0.1: {} + + whatwg-url@5.0.0: + dependencies: + tr46: 0.0.3 + webidl-conversions: 3.0.1 + which-pm-runs@1.1.0: {} which@2.0.2: diff --git a/src/content/posts/diaries/Birth of Retypeset-zh.md b/src/content/posts/diaries/Birth of Retypeset-zh.md index 9265764..2e15c02 100644 --- a/src/content/posts/diaries/Birth of Retypeset-zh.md +++ b/src/content/posts/diaries/Birth of Retypeset-zh.md @@ -8,7 +8,7 @@ lang: zh abbrlink: birth-of-retypeset --- -[Retypeset](https://github.com/radishzzz/astro-theme-retypeset) 是一款基于 Astro 框架的静态博客主题,中文名为重新编排。作为一名编程小白,我花三个月时间开发了这款主题,感受颇多。这篇文章,就来分享一下 Retypeset 诞生的故事。 +Retypeset 是一款基于 Astro 框架的静态博客主题,中文名为重新编排。作为一名编程小白,我花三个月时间开发了这款主题,感受颇多。这篇文章,就来分享一下 Retypeset 诞生的故事。 ## 初遇 diff --git a/src/content/posts/guides/Theme Guide-en.md b/src/content/posts/guides/Theme Guide-en.md index 1d7bb76..977bed0 100644 --- a/src/content/posts/guides/Theme Guide-en.md +++ b/src/content/posts/guides/Theme Guide-en.md @@ -14,7 +14,7 @@ Retypeset is a static blog theme based on the [Astro](https://astro.build/) fram ## Theme Configuration -Customize your blog through the configuration file [src/config.ts](https://github.com/radishzzz/astro-theme-retypeset/blob/master/src/config.ts). +Customize your blog by modifying the configuration file [src/config.ts](https://github.com/radishzzz/astro-theme-retypeset/blob/master/src/config.ts). ### Site Information diff --git a/src/content/posts/guides/Theme Guide-es.md b/src/content/posts/guides/Theme Guide-es.md index 7c868ee..1417d49 100644 --- a/src/content/posts/guides/Theme Guide-es.md +++ b/src/content/posts/guides/Theme Guide-es.md @@ -14,7 +14,7 @@ Retypeset es un tema de blog estático basado en el framework [Astro](https://as ## Configuración del Tema -Personaliza tu blog a través del archivo de configuración [src/config.ts](https://github.com/radishzzz/astro-theme-retypeset/blob/master/src/config.ts). +Personaliza tu blog mediante la modificación del archivo de configuración [src/config.ts](https://github.com/radishzzz/astro-theme-retypeset/blob/master/src/config.ts). ### Información del Sitio diff --git a/src/content/posts/guides/Theme Guide-ja.md b/src/content/posts/guides/Theme Guide-ja.md index 0a280fa..4afc3be 100644 --- a/src/content/posts/guides/Theme Guide-ja.md +++ b/src/content/posts/guides/Theme Guide-ja.md @@ -10,11 +10,11 @@ lang: ja abbrlink: theme-guide --- -Retypesetは、日本語では「再組版」と呼ばれる、[Astro](https://astro.build/) フレームワークをベースにした静的ブログテーマです。本ガイドではテーマの設定方法と新しい記事の作成方法を紹介し、個人ブログを素早く構築できるようサポートします。 +Retypesetは、日本語では「再組版」と呼ばれる、[Astro](https://astro.build/) フレームワークをベースにした静的ブログテーマです。本ガイドではテーマの設定方法と新しい記事の作成方法を紹介し、個人ブログを素早く構築できるよう支援します。 ## テーマ設定 -設定ファイル [src/config.ts](https://github.com/radishzzz/astro-theme-retypeset/blob/master/src/config.ts) からあなたのブログをカスタマイズできます。 +設定ファイル [src/config.ts](https://github.com/radishzzz/astro-theme-retypeset/blob/master/src/config.ts) を変更してあなたのブログをカスタマイズできます。 ### サイト情報 diff --git a/src/content/posts/guides/Theme Guide-ru.md b/src/content/posts/guides/Theme Guide-ru.md index 80a160e..34fdc1d 100644 --- a/src/content/posts/guides/Theme Guide-ru.md +++ b/src/content/posts/guides/Theme Guide-ru.md @@ -14,7 +14,7 @@ Retypeset — это статическая тема блога, основан ## Конфигурация темы -Настройте свой блог через конфигурационный файл [src/config.ts](https://github.com/radishzzz/astro-theme-retypeset/blob/master/src/config.ts). +Настройте свой блог путем изменения конфигурационного файла [src/config.ts](https://github.com/radishzzz/astro-theme-retypeset/blob/master/src/config.ts). ### Информация о сайте diff --git a/src/content/posts/guides/Theme Guide-zh-tw.md b/src/content/posts/guides/Theme Guide-zh-tw.md index c5ed8bb..0b1702d 100644 --- a/src/content/posts/guides/Theme Guide-zh-tw.md +++ b/src/content/posts/guides/Theme Guide-zh-tw.md @@ -10,11 +10,11 @@ lang: zh-tw abbrlink: theme-guide --- -Retypeset 是一款基於 [Astro](https://astro.build/) 框架的靜態部落格主題,中文名為重新編排。本文為 Retypeset 主題上手指南,主要介紹主題配置與如何創建新文章,幫助你快速搭建個人部落格。 +Retypeset 是一款基於 [Astro](https://astro.build/) 框架的靜態部落格主題,中文名為重新編排。本文為 Retypeset 主題上手指南,主要介紹主題配置與如何創建新文章,來幫助你快速搭建個人部落格。 ## 主題配置 -通過配置文件 [src/config.ts](https://github.com/radishzzz/astro-theme-retypeset/blob/master/src/config.ts) 自定義你的部落格。 +通過修改配置文件 [src/config.ts](https://github.com/radishzzz/astro-theme-retypeset/blob/master/src/config.ts) 來自定義你的部落格。 ### 站點信息 diff --git a/src/content/posts/guides/Theme Guide-zh.md b/src/content/posts/guides/Theme Guide-zh.md index acd2323..af46e73 100644 --- a/src/content/posts/guides/Theme Guide-zh.md +++ b/src/content/posts/guides/Theme Guide-zh.md @@ -10,11 +10,11 @@ lang: zh abbrlink: theme-guide --- -Retypeset 是一款基于 [Astro](https://astro.build/) 框架的静态博客主题,中文名为重新编排。本文为 Retypeset 主题上手指南,主要介绍主题配置与如何创建新文章,帮助你快速搭建个人博客。 +Retypeset 是一款基于 [Astro](https://astro.build/) 框架的静态博客主题,中文名为重新编排。本文为 Retypeset 主题上手指南,主要介绍主题配置与如何创建新文章,来帮助你快速搭建个人博客。 ## 主题配置 -通过配置文件 [src/config.ts](https://github.com/radishzzz/astro-theme-retypeset/blob/master/src/config.ts) 自定义你的博客。 +通过修改配置文件 [src/config.ts](https://github.com/radishzzz/astro-theme-retypeset/blob/master/src/config.ts) 来自定义你的博客。 ### 站点信息 diff --git a/src/styles/heti.css b/src/styles/heti.css index c3c56a5..a5efdd4 100644 --- a/src/styles/heti.css +++ b/src/styles/heti.css @@ -19,7 +19,7 @@ /* Links */ .heti :where(a) { - --at-apply: 'underline decoration-secondary/40 underline-0.075em underline-offset-0.14em lg:underline-0.1em'; + --at-apply: 'underline decoration-secondary/40 underline-0.075em underline-offset-0.1em lg:underline-0.1em'; --at-apply: 'font-medium transition-colors tracking-0 hover:(c-primary decoration-secondary/80) '; } @@ -102,7 +102,7 @@ html.dark .heti pre :where(span) { /* Inline Code */ .heti :where(code) { - --at-apply: 'p-0.5 bg-secondary/5 rounded text-0.85em border border-solid border-secondary/5'; + --at-apply: 'px-1 py-0.5 bg-secondary/5 rounded text-0.85em border border-solid border-secondary/5 break-all'; counter-reset: line; } .heti :where(code) span.line { diff --git a/src/utils/description.ts b/src/utils/description.ts index a7401de..9a8eeee 100644 --- a/src/utils/description.ts +++ b/src/utils/description.ts @@ -30,6 +30,15 @@ const EXCERPT_LENGTHS: Record = { + '<': '<', + '>': '>', + '&': '&', + '"': '"', + ''': '\'', + ' ': ' ', +} + // Generate an excerpt from Markdown content export function generateExcerpt( content: string, @@ -39,33 +48,41 @@ export function generateExcerpt( if (!content) return '' + // Remove Markdown headings + const contentWithoutHeadings = content + .replace(/^#{1,6}\s+\S.*$/gm, '') + .replace(/\n{2,}/g, '\n\n') + const length = isCJKLang(lang) ? EXCERPT_LENGTHS[scene].cjk : EXCERPT_LENGTHS[scene].other - // Remove all HTML tags and decode HTML entities - const plainText = parser.render(content) + // Remove all HTML tags + let plainText = parser.render(contentWithoutHeadings) .replace(/<[^>]*>/g, '') - .replace(/</g, '<') - .replace(/>/g, '>') - .replace(/&/g, '&') - .replace(/"/g, '"') - .replace(/'/g, '\'') - .replace(/ /g, ' ') + + // Decode HTML entities using the mapping table + Object.entries(HTML_ENTITIES).forEach(([entity, char]) => { + plainText = plainText.replace(new RegExp(entity, 'g'), char) + }) // Replace line breaks with spaces const normalizedText = plainText.replace(/\s+/g, ' ') + // Remove spaces after CJK punctuation marks + .replace(/([。?!:"」』])\s+/g, '$1') const excerpt = normalizedText.slice(0, length).trim() - // Add ellipsis if text was truncated - return normalizedText.length > length ? `${excerpt}...` : excerpt + // Remove trailing punctuation from the excerpt + if (normalizedText.length > length) + return `${excerpt.replace(/\p{P}+$/u, '')}...` + return excerpt } -// Automatically generate a description for the article +// Automatically Generate article description export function generateDescription( post: CollectionEntry<'posts'>, scene: ExcerptScene, ): string { - // If the article already has a description, return it directly + // Prioritize existing description if (post.data.description) return post.data.description