This commit is contained in:
xugaoyi 2020-12-15 22:10:43 +08:00
parent c4d7b889ed
commit c818433eff
6 changed files with 50 additions and 23 deletions

View File

@ -22,7 +22,7 @@
"vuepress-plugin-one-click-copy": "^1.0.2", "vuepress-plugin-one-click-copy": "^1.0.2",
"vuepress-plugin-thirdparty-search": "^1.0.2", "vuepress-plugin-thirdparty-search": "^1.0.2",
"vuepress-plugin-zooming": "^1.1.7", "vuepress-plugin-zooming": "^1.1.7",
"vuepress-theme-vdoing": "^1.6.3", "vuepress-theme-vdoing": "^1.6.4",
"yamljs": "^0.3.0" "yamljs": "^0.3.0"
}, },
"dependencies": { "dependencies": {

View File

@ -113,10 +113,33 @@ export default {
top $navbarHeight top $navbarHeight
z-index 1 z-index 1
width: 80px 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) &.year:not(:first-child)
margin-top 3.5rem margin-top 3.5rem
h2 h2
margin-top 0
margin-bottom 0.5rem margin-bottom 0.5rem
font-weight 400 font-weight 400
padding 0.5rem 0 padding 0.5rem 0
@ -130,7 +153,7 @@ export default {
transition padding 0.3s transition padding 0.3s
padding 0.4rem 1.2rem padding 0.4rem 1.2rem
margin-left 4.5rem margin-left 4.5rem
border-left 1px solid var(--borderColor) border-left 1px solid $accentColor
line-height 1.2rem line-height 1.2rem
position: relative position: relative
&:hover &:hover
@ -146,7 +169,7 @@ export default {
width .3rem width .3rem
height .3rem height .3rem
border-radius 50% border-radius 50%
background var(--borderColor) background $accentColor
position: absolute; position: absolute;
top .9rem top .9rem
left -0.18rem left -0.18rem

View File

@ -19,7 +19,7 @@
display flex display flex
.main-left .main-left
flex 1 flex 1
width 72% // width 72%
.theme-vdoing-content.card-box .theme-vdoing-content.card-box
padding 1rem 1.5rem padding 1rem 1.5rem
margin-bottom 0.9rem margin-bottom 0.9rem
@ -27,7 +27,7 @@
padding 1rem 1.5rem 0 padding 1rem 1.5rem 0
.main-right .main-right
>* >*
width 255px width 245px
box-sizing border-box box-sizing border-box
@media (max-width 900px) @media (max-width 900px)
width 235px width 235px

View File

@ -88,7 +88,10 @@ function mapTocToPostSidebar (root) {
const contentStr = fs.readFileSync(file, 'utf8') // 读取md文件内容返回字符串 const contentStr = fs.readFileSync(file, 'utf8') // 读取md文件内容返回字符串
const { data } = matter(contentStr) // 解析出front matter数据 const { data } = matter(contentStr) // 解析出front matter数据
const permalink = data.permalink || '' const permalink = data.permalink || ''
postSidebar.push([filename, title, permalink]); // [<路径>, <文件标题>, <永久链接>] if (data.title) {
title = data.title
}
postSidebar.push([filename, title, permalink]); // [<路径>, <标题>, <永久链接>]
}) })
return postSidebar return postSidebar
@ -102,12 +105,11 @@ function mapTocToPostSidebar (root) {
* @param {String} prefix * @param {String} prefix
*/ */
function mapTocToSidebar (root, collapsable, prefix) { function mapTocToSidebar (root, collapsable, prefix = '') {
prefix = prefix || ''; let sidebar = []; // 结构化文章侧边栏数据
let sidebar = [];
const files = fs.readdirSync(root); // 读取目录(文件和文件夹),返回数组 const files = fs.readdirSync(root); // 读取目录(文件和文件夹),返回数组
files.forEach(filename => { // 结构化文章 files.forEach(filename => {
const file = path.resolve(root, filename); // 方法:将路径或路径片段的序列解析为绝对路径 const file = path.resolve(root, filename); // 方法:将路径或路径片段的序列解析为绝对路径
const stat = fs.statSync(file); // 文件信息 const stat = fs.statSync(file); // 文件信息
let [order, title, type] = filename.split('.'); let [order, title, type] = filename.split('.');
@ -133,18 +135,18 @@ function mapTocToSidebar (root, collapsable, prefix) {
const contentStr = fs.readFileSync(file, 'utf8') // 读取md文件内容返回字符串 const contentStr = fs.readFileSync(file, 'utf8') // 读取md文件内容返回字符串
const { data } = matter(contentStr) // 解析出front matter数据 const { data } = matter(contentStr) // 解析出front matter数据
const permalink = data.permalink || '' const permalink = data.permalink || ''
const title2 = data.title || title
if (title2) {
sidebar[order] = [prefix + filename, title2, permalink]; // [<路径>, <front matter.title>, <永久链接>]
} else {
sidebar[order] = [prefix + filename, title, permalink]; // [<路径>, <文件标题>, <永久链接>]
}
// 目录页和永久链接,用于给面包屑提供数据 // 目录页对应的永久链接,用于给面包屑提供链接
const pageComponent = data.pageComponent const { pageComponent } = data
if (pageComponent && pageComponent.name && pageComponent.name === "Catalogue") { if (pageComponent && pageComponent.name === "Catalogue") {
catalogueData[title] = permalink catalogueData[title] = permalink
} }
if (data.title) {
title = data.title
}
sidebar[order] = [prefix + filename, title, permalink]; // [<路径>, <标题>, <永久链接>]
} }
}) })

View File

@ -1,6 +1,6 @@
{ {
"name": "vuepress-theme-vdoing", "name": "vuepress-theme-vdoing",
"version": "1.6.3", "version": "1.6.4",
"description": "Vdoing theme for VuePress. 一个基于VuePress的知识管理兼博客主题。", "description": "Vdoing theme for VuePress. 一个基于VuePress的知识管理兼博客主题。",
"author": { "author": {
"name": "gaoyi(Evan) Xu" "name": "gaoyi(Evan) Xu"

View File

@ -237,11 +237,11 @@ hr
table table
border-collapse collapse border-collapse collapse
margin 1rem 0 margin 1rem 0
// display: block
overflow-x: auto overflow-x: auto
width 100% width 100%
display inline-table display inline-table
@media (max-width: $MQMobile)
display block
tr tr
border-top 1px solid var(--borderColor) border-top 1px solid var(--borderColor)
@ -251,6 +251,8 @@ tr
th, td th, td
border 1px solid var(--borderColor) border 1px solid var(--borderColor)
padding .6em 1em padding .6em 1em
@media (max-width: $MQMobile)
padding .3em .5em
a a
word-break break-all word-break break-all