@mdit-vue/plugin-frontmatter 2.1.2 → 2.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +4 -4
- package/dist/index.d.cts +2 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.mjs +4 -4
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -7,8 +7,8 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
|
|
|
7
7
|
const grayMatter__default = /*#__PURE__*/_interopDefaultCompat(grayMatter);
|
|
8
8
|
|
|
9
9
|
const frontmatterPlugin = (md, { grayMatterOptions, renderExcerpt = true } = {}) => {
|
|
10
|
-
const
|
|
11
|
-
md.
|
|
10
|
+
const parse = md.parse.bind(md);
|
|
11
|
+
md.parse = (src, env = {}) => {
|
|
12
12
|
const { data, content, excerpt = "" } = grayMatter__default(src, grayMatterOptions);
|
|
13
13
|
env.content = content;
|
|
14
14
|
env.frontmatter = {
|
|
@@ -20,12 +20,12 @@ const frontmatterPlugin = (md, { grayMatterOptions, renderExcerpt = true } = {})
|
|
|
20
20
|
// render the excerpt with original markdown-it render method.
|
|
21
21
|
// here we spread `env` to avoid mutating the original object.
|
|
22
22
|
// using deep clone might be a safer choice.
|
|
23
|
-
render(excerpt, { ...env })
|
|
23
|
+
md.render(excerpt, { ...env })
|
|
24
24
|
) : (
|
|
25
25
|
// use the raw excerpt directly
|
|
26
26
|
excerpt
|
|
27
27
|
);
|
|
28
|
-
return
|
|
28
|
+
return parse(content, env);
|
|
29
29
|
};
|
|
30
30
|
};
|
|
31
31
|
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import grayMatter from 'gray-matter';
|
|
2
2
|
|
|
3
3
|
const frontmatterPlugin = (md, { grayMatterOptions, renderExcerpt = true } = {}) => {
|
|
4
|
-
const
|
|
5
|
-
md.
|
|
4
|
+
const parse = md.parse.bind(md);
|
|
5
|
+
md.parse = (src, env = {}) => {
|
|
6
6
|
const { data, content, excerpt = "" } = grayMatter(src, grayMatterOptions);
|
|
7
7
|
env.content = content;
|
|
8
8
|
env.frontmatter = {
|
|
@@ -14,12 +14,12 @@ const frontmatterPlugin = (md, { grayMatterOptions, renderExcerpt = true } = {})
|
|
|
14
14
|
// render the excerpt with original markdown-it render method.
|
|
15
15
|
// here we spread `env` to avoid mutating the original object.
|
|
16
16
|
// using deep clone might be a safer choice.
|
|
17
|
-
render(excerpt, { ...env })
|
|
17
|
+
md.render(excerpt, { ...env })
|
|
18
18
|
) : (
|
|
19
19
|
// use the raw excerpt directly
|
|
20
20
|
excerpt
|
|
21
21
|
);
|
|
22
|
-
return
|
|
22
|
+
return parse(content, env);
|
|
23
23
|
};
|
|
24
24
|
};
|
|
25
25
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mdit-vue/plugin-frontmatter",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.4",
|
|
4
4
|
"description": "A markdown-it plugin to get markdown frontmatter",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"markdown-it",
|
|
@@ -43,13 +43,13 @@
|
|
|
43
43
|
"test": "vitest"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@mdit-vue/types": "2.1.
|
|
47
|
-
"@types/markdown-it": "^14.
|
|
46
|
+
"@mdit-vue/types": "2.1.4",
|
|
47
|
+
"@types/markdown-it": "^14.1.2",
|
|
48
48
|
"gray-matter": "^4.0.3",
|
|
49
49
|
"markdown-it": "^14.1.0"
|
|
50
50
|
},
|
|
51
51
|
"publishConfig": {
|
|
52
52
|
"access": "public"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "01a6daa37fff48ea3992becfd4ba8c0f97a605ad"
|
|
55
55
|
}
|