Skip to content

Commit

Permalink
v1.6.4
Browse files Browse the repository at this point in the history
  • Loading branch information
xugaoyi committed Dec 15, 2020
1 parent c4d7b88 commit c818433
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 24 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
29 changes: 26 additions & 3 deletions theme-vdoing/components/ArchivesPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions theme-vdoing/components/MainLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
display flex
.main-left
flex 1
width 72%
// width 72%
.theme-vdoing-content.card-box
padding 1rem 1.5rem
margin-bottom 0.9rem
.home-content
padding 1rem 1.5rem 0
.main-right
>*
width 255px
width 245px
box-sizing border-box
@media (max-width 900px)
width 235px
Expand Down
32 changes: 17 additions & 15 deletions theme-vdoing/node_utils/getSidebarData.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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('.');
Expand All @@ -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]; // [<路径>, <front matter.title>, <永久链接>]
} 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]; // [<路径>, <标题>, <永久链接>]

}
})

Expand Down
2 changes: 1 addition & 1 deletion theme-vdoing/package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
6 changes: 4 additions & 2 deletions theme-vdoing/styles/index.styl
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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

Expand Down

0 comments on commit c818433

Please sign in to comment.