From b3e54c65aeb932ac8550d34abd5c796108c34c9d Mon Sep 17 00:00:00 2001 From: D-Sketon <2055272094@qq.com> Date: Fri, 27 Oct 2023 09:34:03 +0800 Subject: [PATCH] fix front-matter --- lib/hexo/post.ts | 2 +- lib/plugins/processor/asset.ts | 2 +- lib/plugins/processor/post.ts | 2 +- package.json | 3 ++- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/hexo/post.ts b/lib/hexo/post.ts index 099770fe9e..f9269484e2 100644 --- a/lib/hexo/post.ts +++ b/lib/hexo/post.ts @@ -362,7 +362,7 @@ class Post { // Read the content src = join(draftDir, item); return readFile(src); - }).then(content => { + }).then((content: string) => { // Create post Object.assign(data, yfmParse(content)); data.content = data._content; diff --git a/lib/plugins/processor/asset.ts b/lib/plugins/processor/asset.ts index b4e364b0f8..c56ff62052 100644 --- a/lib/plugins/processor/asset.ts +++ b/lib/plugins/processor/asset.ts @@ -51,7 +51,7 @@ function processPage(ctx: Hexo, file: _File) { return Promise.all([ file.stat(), file.read() - ]).spread((stats: Stats, content: string | Buffer) => { + ]).spread((stats: Stats, content: string) => { const data = yfm(content); const output = ctx.render.getOutput(path); diff --git a/lib/plugins/processor/post.ts b/lib/plugins/processor/post.ts index 7489a84021..c9ec3a1a86 100644 --- a/lib/plugins/processor/post.ts +++ b/lib/plugins/processor/post.ts @@ -89,7 +89,7 @@ function processPost(ctx: Hexo, file: _File) { return Promise.all([ file.stat(), file.read() - ]).spread((stats: Stats, content: string | Buffer) => { + ]).spread((stats: Stats, content: string) => { const data = yfm(content); const info = parseFilename(config.new_post_name, path); const keys = Object.keys(info); diff --git a/package.json b/package.json index a9681ab722..f9cfc7ad34 100644 --- a/package.json +++ b/package.json @@ -66,12 +66,13 @@ "warehouse": "^5.0.0" }, "devDependencies": { - "0x": "^5.1.2", "@types/bluebird": "^3.5.37", "@types/node": "^18.11.8", "@types/nunjucks": "^3.2.2", + "@types/text-table": "^0.2.4", "@typescript-eslint/eslint-plugin": "^5.41.0", "@typescript-eslint/parser": "^5.41.0", + "0x": "^5.1.2", "c8": "^8.0.0", "chai": "^4.3.6", "cheerio": "0.22.0",