@docusaurus/plugin-content-blog 0.0.0-4383 → 0.0.0-4384
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/lib/blogUtils.js +13 -7
- package/package.json +8 -8
- package/src/blogUtils.ts +17 -8
package/lib/blogUtils.js
CHANGED
|
@@ -66,13 +66,19 @@ function formatBlogPostDate(locale, date) {
|
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
async function parseBlogPostMarkdownFile(blogSourceAbsolute) {
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
69
|
+
const markdownString = await fs_extra_1.default.readFile(blogSourceAbsolute, 'utf-8');
|
|
70
|
+
try {
|
|
71
|
+
const result = (0, utils_1.parseMarkdownString)(markdownString, {
|
|
72
|
+
removeContentTitle: true,
|
|
73
|
+
});
|
|
74
|
+
return {
|
|
75
|
+
...result,
|
|
76
|
+
frontMatter: (0, blogFrontMatter_1.validateBlogPostFrontMatter)(result.frontMatter),
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
catch (e) {
|
|
80
|
+
throw new Error(`Error while parsing blog post file ${blogSourceAbsolute}: "${e.message}".`);
|
|
81
|
+
}
|
|
76
82
|
}
|
|
77
83
|
const defaultReadingTime = ({ content, options }) => (0, reading_time_1.default)(content, options).minutes;
|
|
78
84
|
async function processBlogSourceFile(blogSourceRelative, contentPaths, context, options, authorsMap) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/plugin-content-blog",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-4384",
|
|
4
4
|
"description": "Blog plugin for Docusaurus.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "src/plugin-content-blog.d.ts",
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
},
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@docusaurus/core": "0.0.0-
|
|
22
|
-
"@docusaurus/logger": "0.0.0-
|
|
23
|
-
"@docusaurus/mdx-loader": "0.0.0-
|
|
24
|
-
"@docusaurus/utils": "0.0.0-
|
|
25
|
-
"@docusaurus/utils-validation": "0.0.0-
|
|
21
|
+
"@docusaurus/core": "0.0.0-4384",
|
|
22
|
+
"@docusaurus/logger": "0.0.0-4384",
|
|
23
|
+
"@docusaurus/mdx-loader": "0.0.0-4384",
|
|
24
|
+
"@docusaurus/utils": "0.0.0-4384",
|
|
25
|
+
"@docusaurus/utils-validation": "0.0.0-4384",
|
|
26
26
|
"escape-string-regexp": "^4.0.0",
|
|
27
27
|
"feed": "^4.2.2",
|
|
28
28
|
"fs-extra": "^10.0.0",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"webpack": "^5.61.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@docusaurus/types": "0.0.0-
|
|
39
|
+
"@docusaurus/types": "0.0.0-4384"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"react": "^16.8.4 || ^17.0.0",
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"engines": {
|
|
46
46
|
"node": ">=14"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "51cb250b7c01a53bdf32414249281eab0b320df8"
|
|
49
49
|
}
|
package/src/blogUtils.ts
CHANGED
|
@@ -16,7 +16,7 @@ import type {
|
|
|
16
16
|
BlogTags,
|
|
17
17
|
} from './types';
|
|
18
18
|
import {
|
|
19
|
-
|
|
19
|
+
parseMarkdownString,
|
|
20
20
|
normalizeUrl,
|
|
21
21
|
aliasedSitePath,
|
|
22
22
|
getEditUrl,
|
|
@@ -104,13 +104,22 @@ function formatBlogPostDate(locale: string, date: Date): string {
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
async function parseBlogPostMarkdownFile(blogSourceAbsolute: string) {
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
107
|
+
const markdownString = await fs.readFile(blogSourceAbsolute, 'utf-8');
|
|
108
|
+
try {
|
|
109
|
+
const result = parseMarkdownString(markdownString, {
|
|
110
|
+
removeContentTitle: true,
|
|
111
|
+
});
|
|
112
|
+
return {
|
|
113
|
+
...result,
|
|
114
|
+
frontMatter: validateBlogPostFrontMatter(result.frontMatter),
|
|
115
|
+
};
|
|
116
|
+
} catch (e) {
|
|
117
|
+
throw new Error(
|
|
118
|
+
`Error while parsing blog post file ${blogSourceAbsolute}: "${
|
|
119
|
+
(e as Error).message
|
|
120
|
+
}".`,
|
|
121
|
+
);
|
|
122
|
+
}
|
|
114
123
|
}
|
|
115
124
|
|
|
116
125
|
const defaultReadingTime: ReadingTimeFunction = ({content, options}) =>
|