From dd12c5a6a68be808dddf1b3b65863e01ec95fd15 Mon Sep 17 00:00:00 2001 From: yuantao Date: Mon, 16 Sep 2024 17:00:49 +0800 Subject: [PATCH 1/2] =?UTF-8?q?bug:=20cover=E5=AD=97=E6=AE=B5=E6=88=96?= =?UTF-8?q?=E5=80=BC=E4=B8=8D=E5=AD=98=E5=9C=A8=E6=97=B6=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- format-image.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/format-image.js b/format-image.js index d68f738..2654a79 100644 --- a/format-image.js +++ b/format-image.js @@ -1,5 +1,6 @@ const { matterMarkdownAdapter } = require('@elog/cli') +const elogConfig = require('./elog.config') /** * 自定义文档处理器 @@ -8,6 +9,14 @@ const { matterMarkdownAdapter } = require('@elog/cli') * @return {Promise} 返回处理后的文档对象 */ const format = async (doc, imageClient) => { + // 配置中无cover + if (!elogConfig.deploy.local.frontMatter.include.includes('cover')) { + return doc + } + // cover字段实际为空 + if (!doc.properties.cover) { + return doc; + } const cover = doc.properties.cover // 将 cover 字段中的 notion 图片下载到本地 if (imageClient) { From 7321d0b76f6fc34db069e3c376c119e2e8f553ef Mon Sep 17 00:00:00 2001 From: yuantao Date: Mon, 16 Sep 2024 17:06:45 +0800 Subject: [PATCH 2/2] =?UTF-8?q?bug:=20matterMarkdownAdapter=E6=8F=90?= =?UTF-8?q?=E5=89=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- format-image.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/format-image.js b/format-image.js index 2654a79..bd4d53f 100644 --- a/format-image.js +++ b/format-image.js @@ -9,6 +9,7 @@ const elogConfig = require('./elog.config') * @return {Promise} 返回处理后的文档对象 */ const format = async (doc, imageClient) => { + doc.body = matterMarkdownAdapter(doc); // 配置中无cover if (!elogConfig.deploy.local.frontMatter.include.includes('cover')) { return doc @@ -25,7 +26,6 @@ const format = async (doc, imageClient) => { // cover链接替换为本地图片 doc.properties.cover = url } - doc.body = matterMarkdownAdapter(doc); return doc; };