@mdit-vue/plugin-frontmatter 3.0.2 → 4.0.0
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/README.md +2 -2
- package/dist/index.d.ts +5 -10
- package/dist/index.js +2 -5
- package/package.json +19 -22
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ npm i @mdit-vue/plugin-frontmatter
|
|
|
20
20
|
|
|
21
21
|
```ts
|
|
22
22
|
import { frontmatterPlugin } from '@mdit-vue/plugin-frontmatter';
|
|
23
|
-
import type {
|
|
23
|
+
import type { Env } from 'markdown-it';
|
|
24
24
|
import MarkdownIt from 'markdown-it';
|
|
25
25
|
|
|
26
26
|
const md = MarkdownIt({ html: true }).use(frontmatterPlugin, {
|
|
@@ -30,7 +30,7 @@ const md = MarkdownIt({ html: true }).use(frontmatterPlugin, {
|
|
|
30
30
|
excerpt_separator: '<!-- more -->',
|
|
31
31
|
},
|
|
32
32
|
});
|
|
33
|
-
const env:
|
|
33
|
+
const env: Env = {};
|
|
34
34
|
|
|
35
35
|
const rendered = md.render(
|
|
36
36
|
`\
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import grayMatter from "gray-matter";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
//#region src/types.d.ts
|
|
2
|
+
import { MarkdownItPlugin } from "@mdit-vue/types";
|
|
5
3
|
type GrayMatterOptions = grayMatter.GrayMatterOption<string, GrayMatterOptions>;
|
|
6
4
|
/**
|
|
7
5
|
* Options of @mdit-vue/plugin-frontmatter
|
|
@@ -20,8 +18,8 @@ interface FrontmatterPluginOptions {
|
|
|
20
18
|
*/
|
|
21
19
|
renderExcerpt?: boolean;
|
|
22
20
|
}
|
|
23
|
-
declare module '
|
|
24
|
-
interface
|
|
21
|
+
declare module 'markdown-it' {
|
|
22
|
+
interface Env {
|
|
25
23
|
/**
|
|
26
24
|
* The raw Markdown content without frontmatter
|
|
27
25
|
*/
|
|
@@ -39,13 +37,10 @@ declare module '@mdit-vue/types' {
|
|
|
39
37
|
frontmatter?: Record<string, unknown>;
|
|
40
38
|
}
|
|
41
39
|
}
|
|
42
|
-
//#endregion
|
|
43
|
-
//#region src/frontmatter-plugin.d.ts
|
|
44
40
|
/**
|
|
45
41
|
* Get markdown frontmatter and excerpt
|
|
46
42
|
*
|
|
47
43
|
* Extract them into env
|
|
48
44
|
*/
|
|
49
|
-
declare const frontmatterPlugin:
|
|
50
|
-
|
|
51
|
-
export { FrontmatterPluginOptions, frontmatterPlugin };
|
|
45
|
+
export declare const frontmatterPlugin: MarkdownItPlugin<FrontmatterPluginOptions>;
|
|
46
|
+
export type { FrontmatterPluginOptions };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import grayMatter from "gray-matter";
|
|
2
|
-
|
|
3
|
-
//#region src/frontmatter-plugin.ts
|
|
2
|
+
// src/frontmatter-plugin.ts
|
|
4
3
|
/**
|
|
5
4
|
* Get markdown frontmatter and excerpt
|
|
6
5
|
*
|
|
@@ -19,6 +18,4 @@ const frontmatterPlugin = (md, { grayMatterOptions, renderExcerpt = true } = {})
|
|
|
19
18
|
return parse(content, env);
|
|
20
19
|
};
|
|
21
20
|
};
|
|
22
|
-
|
|
23
|
-
//#endregion
|
|
24
|
-
export { frontmatterPlugin };
|
|
21
|
+
export { frontmatterPlugin };
|
package/package.json
CHANGED
|
@@ -1,55 +1,52 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mdit-vue/plugin-frontmatter",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "A markdown-it plugin to get markdown frontmatter",
|
|
5
5
|
"keywords": [
|
|
6
|
+
"excerpt",
|
|
7
|
+
"frontmatter",
|
|
6
8
|
"markdown-it",
|
|
7
9
|
"markdown-it-plugin",
|
|
8
|
-
"vue"
|
|
9
|
-
"frontmatter",
|
|
10
|
-
"excerpt"
|
|
10
|
+
"vue"
|
|
11
11
|
],
|
|
12
12
|
"homepage": "https://github.com/mdit-vue",
|
|
13
13
|
"bugs": {
|
|
14
14
|
"url": "https://github.com/mdit-vue/mdit-vue/issues"
|
|
15
15
|
},
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"author": "meteorlxy <meteor.lxy@foxmail.com>",
|
|
16
18
|
"repository": {
|
|
17
19
|
"type": "git",
|
|
18
20
|
"url": "git+https://github.com/mdit-vue/mdit-vue.git"
|
|
19
21
|
},
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
+
"files": [
|
|
23
|
+
"./dist"
|
|
24
|
+
],
|
|
22
25
|
"type": "module",
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
23
27
|
"exports": {
|
|
24
28
|
".": "./dist/index.js",
|
|
25
29
|
"./package.json": "./package.json"
|
|
26
30
|
},
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
"files": [
|
|
31
|
-
"./dist"
|
|
32
|
-
],
|
|
31
|
+
"publishConfig": {
|
|
32
|
+
"access": "public"
|
|
33
|
+
},
|
|
33
34
|
"scripts": {
|
|
34
35
|
"build": "tsdown",
|
|
35
36
|
"clean": "rimraf ./dist",
|
|
36
37
|
"test": "vitest"
|
|
37
38
|
},
|
|
38
39
|
"dependencies": {
|
|
39
|
-
"@mdit-vue/types": "
|
|
40
|
-
"@types/markdown-it": "^14.1.2",
|
|
40
|
+
"@mdit-vue/types": "4.0.0",
|
|
41
41
|
"gray-matter": "^4.0.3",
|
|
42
|
-
"markdown-it": "^
|
|
42
|
+
"markdown-it": "^15.0.3"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"tsdown": "^0.
|
|
46
|
-
"vitest": "^
|
|
45
|
+
"tsdown": "^0.23.7",
|
|
46
|
+
"vitest": "^5.1.0"
|
|
47
47
|
},
|
|
48
48
|
"engines": {
|
|
49
|
-
"node": ">=20.
|
|
50
|
-
},
|
|
51
|
-
"publishConfig": {
|
|
52
|
-
"access": "public"
|
|
49
|
+
"node": ">=20.19.0"
|
|
53
50
|
},
|
|
54
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "62f17856a1a5dec0e33c6487453a927b82a5883b"
|
|
55
52
|
}
|