Skip to content

Commit ac015dc

Browse files
authored
feat(page-properties): added new page properties plugin (#53)
Signed-off-by: Neko Ayaka <neko@ayaka.moe>
1 parent 08c4e47 commit ac015dc

32 files changed

Lines changed: 1445 additions & 98 deletions

File tree

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@
4040
"./docs",
4141
"./packages/vitepress-plugin-enhanced-readabilities",
4242
"./packages/vitepress-plugin-git-changelog",
43-
"./packages/vitepress-plugin-inline-link-preview"
43+
"./packages/vitepress-plugin-inline-link-preview",
44+
"./packages/vitepress-plugin-page-properties"
4445
],
4546
"typescript.tsdk": "node_modules/typescript/lib"
4647
}

docs/.vitepress/config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ export default defineConfig({
8282
{ text: 'Inline Links Previewing', link: '/pages/en/integrations/vitepress-plugin-inline-link-preview/' },
8383
{ text: 'Blinking highlight targeted heading', link: '/pages/en/integrations/vitepress-plugin-highlight-targeted-heading/' },
8484
{ text: 'Changelog & File history', link: '/pages/en/integrations/vitepress-plugin-git-changelog/' },
85+
{ text: 'Page properties', link: '/pages/en/integrations/vitepress-plugin-page-properties/' },
8586
],
8687
},
8788
],
@@ -132,6 +133,7 @@ export default defineConfig({
132133
{ text: '行内链接预览', link: '/pages/zh-CN/integrations/vitepress-plugin-inline-link-preview/' },
133134
{ text: '闪烁高亮当前的目标标题', link: '/pages/zh-CN/integrations/vitepress-plugin-highlight-targeted-heading/' },
134135
{ text: '变更日志 及 文件历史', link: '/pages/zh-CN/integrations/vitepress-plugin-git-changelog/' },
136+
{ text: '页面属性', link: '/pages/zh-CN/integrations/vitepress-plugin-page-properties/' },
135137
],
136138
},
137139
],

docs/.vitepress/theme/index.ts

Lines changed: 80 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,17 @@ import {
2222
NolebaseGitChangelogPlugin,
2323
} from '@nolebase/vitepress-plugin-git-changelog/client'
2424

25+
import {
26+
NolebasePagePropertiesPlugin,
27+
} from '@nolebase/vitepress-plugin-page-properties/client'
28+
2529
import 'virtual:uno.css'
2630

2731
import '@nolebase/vitepress-plugin-enhanced-readabilities/dist/style.css'
2832
import '@nolebase/vitepress-plugin-inline-link-preview/dist/style.css'
2933
import '@nolebase/vitepress-plugin-highlight-targeted-heading/dist/style.css'
3034
import '@nolebase/vitepress-plugin-git-changelog/client/style.css'
35+
import '@nolebase/vitepress-plugin-page-properties/client/style.css'
3136

3237
import './styles/vars.css'
3338
import './styles/main.css'
@@ -55,7 +60,6 @@ export const Theme: ThemeConfig = {
5560
app.component('HomeContent', HomeContent)
5661

5762
app.use(NolebaseInlineLinkPreviewPlugin)
58-
app.use(NolebaseGitChangelogPlugin)
5963

6064
app.provide(NolebaseEnhancedReadabilitiesInjectionKey, {
6165
layoutSwitch: {
@@ -66,6 +70,7 @@ export const Theme: ThemeConfig = {
6670
},
6771
})
6872

73+
app.use(NolebaseGitChangelogPlugin)
6974
app.provide(NolebaseGitChangelogInjectionKey, {
7075
mapContributors: [
7176
{
@@ -82,6 +87,80 @@ export const Theme: ThemeConfig = {
8287
},
8388
],
8489
})
90+
91+
app.use(NolebasePagePropertiesPlugin<{
92+
tags: string[]
93+
authors: string[]
94+
progress: string[]
95+
createdAt: string
96+
updatedAt: string
97+
url1: string
98+
}>(), {
99+
properties: {
100+
'en': [
101+
{
102+
key: 'tags',
103+
type: 'tags',
104+
title: 'Tags',
105+
},
106+
{
107+
key: 'progress',
108+
type: 'progress',
109+
title: 'Progress',
110+
},
111+
{
112+
key: 'createdAt',
113+
type: 'datetime',
114+
title: 'Created at',
115+
formatAsFrom: true,
116+
dateFnsLocaleName: 'enUS',
117+
},
118+
{
119+
key: 'updatedAt',
120+
type: 'datetime',
121+
title: 'Updated at',
122+
formatAsFrom: true,
123+
dateFnsLocaleName: 'enUS',
124+
},
125+
{
126+
key: 'url1',
127+
type: 'link',
128+
title: 'URL 1',
129+
},
130+
],
131+
'zh-CN': [
132+
{
133+
key: 'tags',
134+
type: 'tags',
135+
title: '标签',
136+
},
137+
{
138+
key: 'progress',
139+
type: 'progress',
140+
title: '进度',
141+
},
142+
{
143+
key: 'createdAt',
144+
type: 'datetime',
145+
title: '创建时间',
146+
formatAsFrom: true,
147+
dateFnsLocaleName: 'zhCN',
148+
},
149+
{
150+
key: 'updatedAt',
151+
type: 'datetime',
152+
title: '更新时间',
153+
formatAsFrom: true,
154+
dateFnsLocaleName: 'zhCN',
155+
},
156+
{
157+
key: 'url1',
158+
type: 'link',
159+
title: '链接 1',
160+
},
161+
],
162+
},
163+
})
85164
},
86165
}
87166

docs/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
"@nolebase/vitepress-plugin-enhanced-readabilities": "workspace:^",
1616
"@nolebase/vitepress-plugin-git-changelog": "workspace:^",
1717
"@nolebase/vitepress-plugin-highlight-targeted-heading": "workspace:^",
18-
"@nolebase/vitepress-plugin-inline-link-preview": "workspace:^"
18+
"@nolebase/vitepress-plugin-inline-link-preview": "workspace:^",
19+
"@nolebase/vitepress-plugin-page-properties": "workspace:^",
20+
"vite-plugin-inspect": "^0.8.3"
1921
}
2022
}

docs/pages/en/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ Nólëbase Integrations project provides a variety of integrations, plugins, com
4646

4747
<IntegrationCard type="vitepress" title="Changelog & File history" package="vitepress-plugin-git-changelog" />
4848

49+
<IntegrationCard type="vitepress" title="Page properties" package="vitepress-plugin-page-properties" />
50+
4951
<IntegrationCard type="obsidian" title="UnoCSS" package="obsidian-plugin-unocss" />
5052

5153
</div>

docs/pages/en/integrations/index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,8 @@ Nólëbase Integrations project provides a variety of integrations, plugins, com
3030

3131
<br />
3232

33+
<IntegrationCard type="vitepress" title="Page properties" package="vitepress-plugin-page-properties" />
34+
35+
<br />
36+
3337
<IntegrationCard type="obsidian" title="UnoCSS" package="obsidian-plugin-unocss" />
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
tags:
3+
- Integrations/VitePress-Plugin
4+
- Integrations/VitePress-Plugin/Page-Properties
5+
- Markdown/frontmatter
6+
progress: 85
7+
url1: https://nolebase-integrations.ayaka.io/pages/en/
8+
createdAt: 2024-01-23
9+
updatedAt: 2024-01-23
10+
---
11+
12+
# Page properties

docs/pages/zh-CN/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ Nólëbase 集成项目提供多种不同的集成、插件、组件和库来方
4646

4747
<IntegrationCard type="vitepress" title="变更日志 及 文件历史" package="vitepress-plugin-git-changelog" />
4848

49+
<IntegrationCard type="vitepress" title="页面属性" package="vitepress-plugin-page-properties" />
50+
4951
<IntegrationCard type="obsidian" title="UnoCSS" package="obsidian-plugin-unocss" />
5052

5153
</div>

docs/pages/zh-CN/integrations/index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,8 @@ Nólëbase 集成项目提供多种不同的集成、插件、组件和库来方
3030

3131
<br />
3232

33+
<IntegrationCard type="vitepress" title="页面属性" package="vitepress-plugin-page-properties" />
34+
35+
<br />
36+
3337
<IntegrationCard type="obsidian" title="UnoCSS" package="obsidian-plugin-unocss" />
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
tags:
3+
- 集成/VitePress-插件
4+
- 集成/VitePress-插件/页面属性
5+
- Markdown/frontmatter
6+
progress: 35
7+
url1: https://nolebase-integrations.ayaka.io/pages/zh-CN/
8+
createdAt: 2024-01-23
9+
updatedAt: 2024-01-23
10+
---
11+
12+
# 页面属性

0 commit comments

Comments
 (0)