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 主题
@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%;
height: 80px;
}
.book_header{
.book_header {
position: fixed;
top: 0px;
width: 100%;
@@ -13,13 +31,13 @@
// background-color: aquamarine;
// background-color: #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;
flex-direction: row;
align-items: center;
justify-content: space-between;
.book_header_left{
.book_header_left {
width: 100px;
display: flex;
flex-direction: row;
@@ -27,17 +45,15 @@
justify-content: center;
color: #69b1ff;
}
.book_header_middle{
.book_header_middle {
flex: 1;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
color: #69b1ff;
}
.book_header_right{
.book_header_right {
width: 100px;
// background-color: yellow;
display: flex;
@@ -45,10 +61,7 @@
align-items: center;
justify-content: center;
color: #69b1ff;
}
}
.Book {
padding: 40px;
@@ -71,13 +84,12 @@
// background-color: aqua;
.at-list__item-container {
.at-list__item-content {}
.at-list__item-content {
}
}
}
}
}
}
@media (min-width: 1536px) {
@@ -110,4 +122,4 @@
background-color: greenyellow;
}
}
}
}

View File

@@ -70,7 +70,9 @@ const Book = () => {
const handleJump = (text) => {
const h1Elements = contentRef.current.querySelectorAll("h1");
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" });
break;
}