File tree Expand file tree Collapse file tree 4 files changed +23
-6
lines changed Expand file tree Collapse file tree 4 files changed +23
-6
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,12 @@ export const createPage = async (
39
39
const frontmatter = resolvePageFrontmatter ( { frontmatterRaw, options } )
40
40
41
41
// resolve excerpt from raw excerpt
42
- const excerpt = resolvePageExcerpt ( { excerptRaw, app, filePathRelative } )
42
+ const excerpt = resolvePageExcerpt ( {
43
+ app,
44
+ excerptRaw,
45
+ filePathRelative,
46
+ frontmatter,
47
+ } )
43
48
44
49
// resolve slug from file path
45
50
const slug = resolvePageSlug ( { filePathRelative } )
@@ -86,6 +91,7 @@ export const createPage = async (
86
91
app,
87
92
content,
88
93
filePathRelative,
94
+ frontmatter,
89
95
htmlFilePathRelative,
90
96
key,
91
97
} )
Original file line number Diff line number Diff line change @@ -4,20 +4,22 @@ import type {
4
4
MarkdownLink ,
5
5
} from '@vuepress/markdown'
6
6
import { path } from '@vuepress/utils'
7
- import type { App } from '../types'
7
+ import type { App , PageFrontmatter } from '../types'
8
8
9
9
/**
10
10
* Resolve page component and related info
11
11
*/
12
12
export const resolvePageComponentInfo = async ( {
13
13
app,
14
14
content,
15
+ frontmatter,
15
16
filePathRelative,
16
17
htmlFilePathRelative,
17
18
key,
18
19
} : {
19
20
app : App
20
21
content : string
22
+ frontmatter : PageFrontmatter
21
23
filePathRelative : string | null
22
24
htmlFilePathRelative : string | null
23
25
key : string
@@ -32,6 +34,7 @@ export const resolvePageComponentInfo = async ({
32
34
const markdownEnv : MarkdownEnv = {
33
35
base : app . options . base ,
34
36
filePathRelative,
37
+ frontmatter,
35
38
}
36
39
37
40
const rendered = app . markdown . render ( content , markdownEnv )
Original file line number Diff line number Diff line change 1
1
import type { MarkdownEnv } from '@vuepress/markdown'
2
- import type { App } from '../types'
2
+ import type { App , PageFrontmatter } from '../types'
3
3
4
4
/**
5
5
* Resolve page excerpt from raw excerpt
6
6
*/
7
7
export const resolvePageExcerpt = ( {
8
- excerptRaw,
9
8
app,
9
+ excerptRaw,
10
+ frontmatter,
10
11
filePathRelative,
11
12
} : {
12
- excerptRaw : string
13
13
app : App
14
+ excerptRaw : string
15
+ frontmatter : PageFrontmatter
14
16
filePathRelative : string | null
15
17
} ) : string => {
16
18
const markdownEnv : MarkdownEnv = {
17
19
base : app . options . base ,
18
20
filePathRelative,
21
+ frontmatter,
19
22
}
20
23
const html = app . markdown . render ( excerptRaw , markdownEnv )
21
24
return html
Original file line number Diff line number Diff line change 1
1
import * as MarkdownIt from 'markdown-it'
2
- import type { PageHeader } from '@vuepress/shared'
2
+ import type { PageFrontmatter , PageHeader } from '@vuepress/shared'
3
3
import type {
4
4
AnchorPluginOptions ,
5
5
AssetsPluginOptions ,
@@ -61,6 +61,11 @@ export interface MarkdownEnv {
61
61
*/
62
62
filePathRelative ?: string | null
63
63
64
+ /**
65
+ * Frontmatter of the markdown file
66
+ */
67
+ frontmatter ?: PageFrontmatter
68
+
64
69
// Output
65
70
66
71
/**
You can’t perform that action at this time.
0 commit comments