From 50e86570683ef7f5e94e6c46ead9c53688915c4c Mon Sep 17 00:00:00 2001 From: Danpa_cho Date: Thu, 21 Mar 2024 20:52:27 +0900 Subject: [PATCH] refactor: obsidian reference plugin with processor --- .../builder/plugin/core/contents/obsidian.reference.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/build_system/src/builder/plugin/core/contents/obsidian.reference.ts b/packages/build_system/src/builder/plugin/core/contents/obsidian.reference.ts index 834f466..666e851 100644 --- a/packages/build_system/src/builder/plugin/core/contents/obsidian.reference.ts +++ b/packages/build_system/src/builder/plugin/core/contents/obsidian.reference.ts @@ -1,6 +1,5 @@ import { toMarkdown } from 'mdast-util-to-markdown' import { remark } from 'remark' -import remarkFrontmatter from 'remark-frontmatter' import remarkHtml from 'remark-html' import type { Plugin } from 'unified' import type { Literal, Parent } from 'unist' @@ -95,10 +94,10 @@ const RemarkObsidianReferencePlugin: Plugin< export const ObsidianReference = (): BuilderPlugin['build:contents'] => - async ({ io }) => { + async ({ io, processor }) => { return { name: 'ObsidianReference', - modifier: async (buildStore) => { + modifier: async ({ buildStore }) => { const assetReferencesUUIDList = buildStore .filter( ({ file_type }) => @@ -128,12 +127,12 @@ export const ObsidianReference = textFile.build_path.build ) if (textFileContent.success) { - const updatedVFile = await remark() + const updatedVFile = await processor + .remark() .use(RemarkObsidianReferencePlugin, { imageReference: assetReferencesUUIDList, io, }) - .use(remarkFrontmatter) .process(textFileContent.data) awaitedAcc.push({ @@ -143,6 +142,7 @@ export const ObsidianReference = } return acc }, Promise.resolve([])) + return referenceUpdatedList }, }