diff --git a/package.json b/package.json index 249f60c..5befe40 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "vuepress-plugin-one-click-copy": "^1.0.2", "vuepress-plugin-thirdparty-search": "^1.0.2", "vuepress-plugin-zooming": "^1.1.7", - "vuepress-theme-vdoing": "^1.6.3", + "vuepress-theme-vdoing": "^1.6.4", "yamljs": "^0.3.0" }, "dependencies": { diff --git a/theme-vdoing/components/ArchivesPage.vue b/theme-vdoing/components/ArchivesPage.vue index 155c455..2d6307a 100644 --- a/theme-vdoing/components/ArchivesPage.vue +++ b/theme-vdoing/components/ArchivesPage.vue @@ -113,10 +113,33 @@ export default { top $navbarHeight z-index 1 width: 80px - margin-bottom -1.8rem + &+ li + position relative + &::before + content '' + display block + width .5rem + height .5rem + border-radius 50% + border 1px solid $accentColor + position absolute + left 4.25rem + top -2.1rem + a + position relative + &::after + content '' + display block + width 1px + height 1.5rem + background $accentColor + position absolute + left -1px + top -1.5rem &.year:not(:first-child) margin-top 3.5rem h2 + margin-top 0 margin-bottom 0.5rem font-weight 400 padding 0.5rem 0 @@ -130,7 +153,7 @@ export default { transition padding 0.3s padding 0.4rem 1.2rem margin-left 4.5rem - border-left 1px solid var(--borderColor) + border-left 1px solid $accentColor line-height 1.2rem position: relative &:hover @@ -146,7 +169,7 @@ export default { width .3rem height .3rem border-radius 50% - background var(--borderColor) + background $accentColor position: absolute; top .9rem left -0.18rem diff --git a/theme-vdoing/components/MainLayout.vue b/theme-vdoing/components/MainLayout.vue index 4cd4ac4..7cc938d 100644 --- a/theme-vdoing/components/MainLayout.vue +++ b/theme-vdoing/components/MainLayout.vue @@ -19,7 +19,7 @@ display flex .main-left flex 1 - width 72% + // width 72% .theme-vdoing-content.card-box padding 1rem 1.5rem margin-bottom 0.9rem @@ -27,7 +27,7 @@ padding 1rem 1.5rem 0 .main-right >* - width 255px + width 245px box-sizing border-box @media (max-width 900px) width 235px diff --git a/theme-vdoing/node_utils/getSidebarData.js b/theme-vdoing/node_utils/getSidebarData.js index 6fe4452..c40690e 100644 --- a/theme-vdoing/node_utils/getSidebarData.js +++ b/theme-vdoing/node_utils/getSidebarData.js @@ -88,7 +88,10 @@ function mapTocToPostSidebar (root) { const contentStr = fs.readFileSync(file, 'utf8') // 读取md文件内容,返回字符串 const { data } = matter(contentStr) // 解析出front matter数据 const permalink = data.permalink || '' - postSidebar.push([filename, title, permalink]); // [<路径>, <文件标题>, <永久链接>] + if (data.title) { + title = data.title + } + postSidebar.push([filename, title, permalink]); // [<路径>, <标题>, <永久链接>] }) return postSidebar @@ -102,12 +105,11 @@ function mapTocToPostSidebar (root) { * @param {String} prefix */ -function mapTocToSidebar (root, collapsable, prefix) { - prefix = prefix || ''; - let sidebar = []; +function mapTocToSidebar (root, collapsable, prefix = '') { + let sidebar = []; // 结构化文章侧边栏数据 const files = fs.readdirSync(root); // 读取目录(文件和文件夹),返回数组 - files.forEach(filename => { // 结构化文章 + files.forEach(filename => { const file = path.resolve(root, filename); // 方法:将路径或路径片段的序列解析为绝对路径 const stat = fs.statSync(file); // 文件信息 let [order, title, type] = filename.split('.'); @@ -133,18 +135,18 @@ function mapTocToSidebar (root, collapsable, prefix) { const contentStr = fs.readFileSync(file, 'utf8') // 读取md文件内容,返回字符串 const { data } = matter(contentStr) // 解析出front matter数据 const permalink = data.permalink || '' - const title2 = data.title || title - if (title2) { - sidebar[order] = [prefix + filename, title2, permalink]; // [<路径>, , <永久链接>] - } else { - sidebar[order] = [prefix + filename, title, permalink]; // [<路径>, <文件标题>, <永久链接>] - } - // 目录页和永久链接,用于给面包屑提供数据 - const pageComponent = data.pageComponent - if (pageComponent && pageComponent.name && pageComponent.name === "Catalogue") { + // 目录页对应的永久链接,用于给面包屑提供链接 + const { pageComponent } = data + if (pageComponent && pageComponent.name === "Catalogue") { catalogueData[title] = permalink } + + if (data.title) { + title = data.title + } + sidebar[order] = [prefix + filename, title, permalink]; // [<路径>, <标题>, <永久链接>] + } }) diff --git a/theme-vdoing/package.json b/theme-vdoing/package.json index f69d1a7..5abfd87 100644 --- a/theme-vdoing/package.json +++ b/theme-vdoing/package.json @@ -1,6 +1,6 @@ { "name": "vuepress-theme-vdoing", - "version": "1.6.3", + "version": "1.6.4", "description": "Vdoing theme for VuePress. 一个基于VuePress的知识管理兼博客主题。", "author": { "name": "gaoyi(Evan) Xu" diff --git a/theme-vdoing/styles/index.styl b/theme-vdoing/styles/index.styl index 5611f16..6db0bbb 100644 --- a/theme-vdoing/styles/index.styl +++ b/theme-vdoing/styles/index.styl @@ -237,11 +237,11 @@ hr table border-collapse collapse margin 1rem 0 - // display: block overflow-x: auto width 100% display inline-table - + @media (max-width: $MQMobile) + display block tr border-top 1px solid var(--borderColor) @@ -251,6 +251,8 @@ tr th, td border 1px solid var(--borderColor) padding .6em 1em + @media (max-width: $MQMobile) + padding .3em .5em a word-break break-all