-
- {data.category_name} · {data.category_code.toUpperCase()}
- {published_at}
+ ((resolve) => {
- img.addEventListener("load", () => resolve(), {once: true});
- img.addEventListener("error", () => resolve(), {once: true});
+ img.addEventListener("load", () => resolve(), { once: true });
+ img.addEventListener("error", () => resolve(), { once: true });
});
};
@@ -201,7 +212,6 @@ const published_at = formatDatetime(data.published_at, "YYYY.MM.DD");
init();
-
const copyTimers = new WeakMap>();
// 代码块复制功能
@@ -209,7 +219,7 @@ const published_at = formatDatetime(data.published_at, "YYYY.MM.DD");
text: (el) => {
const sibling = el.closest(".code-header")?.nextElementSibling;
return sibling?.textContent.trim() || "";
- }
+ },
});
clipboard.on("success", (e) => {
diff --git a/src/styles/global.css b/src/styles/global.css
index 4f00e56..e101806 100644
--- a/src/styles/global.css
+++ b/src/styles/global.css
@@ -2,7 +2,10 @@
@import "css-reset.css";
:root {
- --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
+ --font-family:
+ -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
+ "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial,
+ sans-serif;
--layout-width: 760px;
--background: #ffffff;
@@ -12,11 +15,11 @@
--text-secondary: #3f3f46;
--text-disabled: #d1d5db;
--text-meta: #71717a;
- --article-text-color: #404040;
+ --article-text-color: #1e1e1e;
--text-title-hover: #000;
-
--code-block-header-bg: #f5f5f4;
--code-block-copy-btn-hover-color: #6b7280;
+ --text-summary: #000;
}
.dark {
@@ -29,18 +32,9 @@
--text-meta: #d4d4d8;
--article-text-color: #d4d4d8;
--text-title-hover: #fff;
-
--code-block-header-bg: #374151;
--code-block-copy-btn-hover-color: #9ca3af;
-}
-
-html,
-body {
- width: 100%;
- height: 100%;
- min-height: 100%;
- font-family: var(--font-family), serif;
- color: var(--text-primary);
+ --text-summary: #fff;
}
::-webkit-scrollbar {
@@ -55,11 +49,25 @@ body {
/* 滚动条滑块 */
::-webkit-scrollbar-thumb {
- background: rgba(139,139,139,.5);
+ background: rgba(139, 139, 139, 0.5);
border-radius: 999px;
}
/* 鼠标悬停 */
::-webkit-scrollbar-thumb:hover {
- background: rgba(139,139,139,.7);
+ background: rgba(139, 139, 139, 0.7);
+}
+
+html,
+body {
+ width: 100%;
+ height: 100%;
+ min-height: 100%;
+ font-family: var(--font-family), serif;
+ color: var(--text-primary);
+ background: var(--background);
+}
+
+html {
+ scroll-behavior: smooth;
}
+
+
-
+
+
+ {data.category_name} · {data.category_code.toUpperCase()}
+ {published_at}
+
+
+ {data.view_count} 次阅读
{data.title}
-{data.view_count} 次阅读
- {data.title}
+ { + data.cover && ( +
+
+
+ )
+ }
- {data.cover &&
-
-
-
- }
+ {data.summary}
-{data.summary}
+ - + -
+ {
+ data.tags.length > 0 && (
+ }
+
@@ -146,7 +157,7 @@ const published_at = formatDatetime(data.published_at, "YYYY.MM.DD");
const article = document.querySelector(".markdown-body")!;
const images = Array.from(article.querySelectorAll("img"));
- if(images.length === 0) return
+ if (images.length === 0) return;
const waitImageLoaded = (img: HTMLImageElement) => {
if (img.complete && img.naturalWidth > 0 && img.naturalHeight > 0) {
@@ -154,8 +165,8 @@ const published_at = formatDatetime(data.published_at, "YYYY.MM.DD");
}
return new Promise
+ {data.tags.map((tag) => (
+ {tag.name}
+ ))}
+
+ )
+ }
+
- {
- data.tags.length > 0 &&
-
- {data.tags.map(tag => {tag.name})}
-
- }
-
+ {toc.length > 0 &&