diff --git a/astro.config.mjs b/astro.config.mjs index 16f9289..0f91b92 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -5,6 +5,7 @@ import svelte from "@astrojs/svelte"; import rehypeMermaid from "rehype-mermaid"; import remarkMath from "remark-math"; import rehypeKatex from "rehype-katex"; +import rehypeImageCaptions from "./src/plugins/rehype-image-captions.mjs"; // https://astro.build/config import { fileURLToPath } from 'node:url' @@ -27,6 +28,7 @@ export default defineConfig({ excludeLangs: ['mermaid', 'math'], }, rehypePlugins: [ + rehypeImageCaptions, rehypeMermaid, rehypeKatex, ], diff --git a/src/components/FloatingActions.astro b/src/components/FloatingActions.astro index 72da520..20d1f0c 100644 --- a/src/components/FloatingActions.astro +++ b/src/components/FloatingActions.astro @@ -62,14 +62,13 @@ border-right: var(--deep-blue) 2.5px solid; border-bottom: var(--deep-blue) 2.5px solid; border-radius: 999px; - background: rgba(255, 255, 255, 0.92); + background: color-mix(in srgb, var(--background-color) 94%, transparent); color: #222; /* box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16); */ cursor: pointer; display: flex; align-items: center; justify-content: center; - backdrop-filter: blur(6px); } #theme-toggle-fab { @@ -141,10 +140,16 @@ :global(.dark) #theme-toggle-fab, :global(.dark) #back-to-top { - background: rgba(34, 34, 34, 0.92); + background: color-mix( + in srgb, + var(--background-color-dark) 94%, + transparent + ); color: #f5f5f5; - box-shadow: 0 4px 14px rgba(0, 0, 0, 0.32); - border: #515151 2px solid; + border-top-color: #515151; + border-left-color: #515151; + border-right-color: #515151; + border-bottom-color: #515151; } @media (max-width: 640px) { diff --git a/src/components/FriendlyLinks/FriendsDescription.astro b/src/components/FriendlyLinks/FriendsDescription.astro index a1e2dad..1ace251 100644 --- a/src/components/FriendlyLinks/FriendsDescription.astro +++ b/src/components/FriendlyLinks/FriendsDescription.astro @@ -20,7 +20,7 @@ const t = getTranslations(lang); {t.friends.content.map((line: string) =>

)}

-
---
+        
---
 name: 'CLoverta的博客'
 description: "欢迎光临,请进门左转"
 url: "https://blog.cloverta.top"
@@ -59,27 +59,35 @@ avatar: 'https://s2.loli.net/2025/11/22/tiDKuzdqycx1v9B.png'
     }
 
     .friend-code-block {
-        background: #fbf5f2;
-        border: 1px solid #8fa1ad;
-        border-radius: 3px;
-        padding: 0rem;
-        overflow-x: auto;
-        /* color: var(--text-color); */
+        min-width: 0;
+        margin-top: 1rem;
     }
 
-    :global(.dark) .friend-code-block {
-        background: rgba(127, 127, 127, 0.12);
+    .friend-code-block :global(.code-block-wrapper) {
+        margin: 0;
+        overflow: hidden;
+        border: 1px solid #8fa1ad;
+        border-radius: 3px;
     }
 
     .friend-code-block pre {
         margin: 0;
+        background: var(--comment-background);
     }
 
     .friend-code-block code {
-        font-family: monospace;
+        font-family: "Maple Mono", monospace;
         white-space: pre;
     }
 
+    :global(.dark) .friend-code-block :global(.code-block-wrapper) {
+        border-color: rgba(170, 183, 196, 0.45);
+    }
+
+    :global(.dark) .friend-code-block pre {
+        background: rgba(127, 127, 127, 0.12);
+    }
+
     .image-wrap {
         width: fit-content;
         margin: 0 auto;
diff --git a/src/components/LatestComments.astro b/src/components/LatestComments.astro
index 3b2566c..04e206f 100644
--- a/src/components/LatestComments.astro
+++ b/src/components/LatestComments.astro
@@ -65,6 +65,13 @@ const heading = lang === "zh" ? "最新评论" : "Latest comments";
         }
     }
 
+    function getDiscussionUrl(url, lang) {
+        const localizedUrl = rewritePostUrl(url, lang);
+        if (!localizedUrl || localizedUrl === "#") return "#";
+
+        return `${localizedUrl.split("#")[0]}#comments`;
+    }
+
     function getAvatar(item) {
         return (
             item?.user?.picture || item?.user?.photo || item?.user?.avatar || ""
@@ -226,6 +233,9 @@ const heading = lang === "zh" ? "最新评论" : "Latest comments";
                 const href = escapeHtml(
                     rewritePostUrl(item?.locator?.url || "", lang),
                 );
+                const discussionHref = escapeHtml(
+                    getDiscussionUrl(item?.locator?.url || "", lang),
+                );
 
                 const preview = getCommentPreview(item?.text, lang);
                 const time = formatTime(item?.time, lang);
@@ -260,8 +270,13 @@ const heading = lang === "zh" ? "最新评论" : "Latest comments";
               
${preview}
@@ -269,6 +284,18 @@ const heading = lang === "zh" ? "最新评论" : "Latest comments"; }) .join(""); + requestAnimationFrame(() => { + list.querySelectorAll(".comment-card").forEach((card) => { + const preview = card.querySelector(".comment-card-text"); + if (!preview) return; + + card.classList.toggle( + "is-truncated", + preview.scrollHeight > preview.clientHeight + 1, + ); + }); + }); + loading.style.display = "none"; } diff --git a/src/components/Posts/PostMenu.astro b/src/components/Posts/PostMenu.astro index 12ffb62..1402303 100644 --- a/src/components/Posts/PostMenu.astro +++ b/src/components/Posts/PostMenu.astro @@ -83,6 +83,9 @@ const tocHeadings = headings.filter((h) => h.depth === 2 || h.depth === 3); diff --git a/src/pages/404.astro b/src/pages/404.astro index 15e2ada..a8ad11c 100644 --- a/src/pages/404.astro +++ b/src/pages/404.astro @@ -7,7 +7,7 @@ import "@/styles/global.css"; pageTitle="404 Not Found" description="Sorry, the page doesn't exists" > -
+
Marisa

对不起,您请求的页面不存在哦。

diff --git a/src/pages/[lang]/about.astro b/src/pages/[lang]/about.astro index 1008196..39473f5 100644 --- a/src/pages/[lang]/about.astro +++ b/src/pages/[lang]/about.astro @@ -16,7 +16,7 @@ const pageTitle = t.about.title; pageTitle=`${pageTitle} - ${t.banner.title}` image={t.about.profilePicture} > -
+

{t.about.title}

@@ -36,14 +36,12 @@ const pageTitle = t.about.title;
{t.about.content.map((line: string) =>

)}

-
+