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,11 +1,29 @@
// 在 src/index.scss 中引入 GitHub Markdown 主题 // 在 src/index.scss 中引入 GitHub Markdown 主题
@import "github-markdown-css/github-markdown.css"; @import "github-markdown-css/github-markdown.css";
.book_header_div{
// 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 {
width: 100%; width: 100%;
height: 80px; height: 80px;
} }
.book_header{ .book_header {
position: fixed; position: fixed;
top: 0px; top: 0px;
width: 100%; width: 100%;
@@ -13,13 +31,13 @@
// background-color: aquamarine; // background-color: aquamarine;
// background-color: #f0f5ff; // background-color: #f0f5ff;
border-bottom: 2px solid #f0f5ff; border-bottom: 2px solid #f0f5ff;
background-color: rgb(255 255 255/var(--tw-bg-opacity,1)); background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1));
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
.book_header_left{ .book_header_left {
width: 100px; width: 100px;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
@@ -27,17 +45,15 @@
justify-content: center; justify-content: center;
color: #69b1ff; color: #69b1ff;
} }
.book_header_middle{ .book_header_middle {
flex: 1; flex: 1;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
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;
// background-color: yellow; // background-color: yellow;
display: flex; display: flex;
@@ -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) {
@@ -110,4 +122,4 @@
background-color: greenyellow; background-color: greenyellow;
} }
} }
} }

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;
} }