This commit is contained in:
hackrobot
2025-04-02 06:52:46 -05:00
parent bd9794d50f
commit e4fbf78de2
2 changed files with 30 additions and 16 deletions

View File

@@ -1,6 +1,24 @@
// 在 src/index.scss 中引入 GitHub Markdown 主题 // 在 src/index.scss 中引入 GitHub Markdown 主题
@import "github-markdown-css/github-markdown.css"; @import "github-markdown-css/github-markdown.css";
// marktext的换行处理
.markdown-body p,
.markdown-body blockquote,
.markdown-body ul,
.markdown-body ol,
.markdown-body dl,
.markdown-body table,
.markdown-body pre,
.markdown-body details {
margin-bottom: 10px;
}
.markdown-body li>p {
margin-top: 0px;
}
.book_header_div { .book_header_div {
width: 100%; width: 100%;
height: 80px; height: 80px;
@@ -34,8 +52,6 @@
align-items: center; align-items: center;
justify-content: center; justify-content: center;
color: #69b1ff; color: #69b1ff;
} }
.book_header_right { .book_header_right {
width: 100px; width: 100px;
@@ -45,10 +61,7 @@
align-items: center; align-items: center;
justify-content: center; justify-content: center;
color: #69b1ff; color: #69b1ff;
} }
} }
.Book { .Book {
padding: 40px; padding: 40px;
@@ -71,13 +84,12 @@
// background-color: aqua; // background-color: aqua;
.at-list__item-container { .at-list__item-container {
.at-list__item-content {} .at-list__item-content {
}
} }
} }
} }
} }
} }
@media (min-width: 1536px) { @media (min-width: 1536px) {

View File

@@ -70,7 +70,9 @@ const Book = () => {
const handleJump = (text) => { const handleJump = (text) => {
const h1Elements = contentRef.current.querySelectorAll("h1"); const h1Elements = contentRef.current.querySelectorAll("h1");
for (let h1 of h1Elements) { for (let h1 of h1Elements) {
if (h1.textContent === text) { if (h1.textContent.trim() === text.trim()) {
console.log("Current h1 text:", h1.textContent); // 输出每个 h1 的文本
// if (h1.textContent === text) {
h1.scrollIntoView({ behavior: "smooth" }); h1.scrollIntoView({ behavior: "smooth" });
break; break;
} }