From f83ca160b8bc789f4c5a2075a7760404e04d9344 Mon Sep 17 00:00:00 2001 From: Emile Bangma Date: Thu, 19 Sep 2024 12:32:09 +0000 Subject: [PATCH] Fixed Obsidian Highlights parser --- quartz/plugins/parsers/obsidian/highlights.ts | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/quartz/plugins/parsers/obsidian/highlights.ts b/quartz/plugins/parsers/obsidian/highlights.ts index 2e4b46812..774aab1a2 100644 --- a/quartz/plugins/parsers/obsidian/highlights.ts +++ b/quartz/plugins/parsers/obsidian/highlights.ts @@ -2,7 +2,7 @@ import { QuartzParserPlugin } from "../../types" import { ReplaceFunction, findAndReplace as mdastFindReplace } from "mdast-util-find-and-replace" import { JSResource } from "../../../util/resources" import { Root } from "mdast" -import { PluggableList } from "unified" +import { Pluggable } from "unified" interface Options { enabled: Boolean @@ -25,27 +25,27 @@ export const ObsidianHighlights: QuartzParserPlugin> = (userOpt return src }, markdownPlugins(_ctx) { - return [ - (tree: Root) => { - if (opts.enabled) { - const replacements: [RegExp, string | ReplaceFunction][] = [] - replacements.push([ - highlightRegex, - (_value: string, ...capture: string[]) => { - const [inner] = capture - return { - type: "html", - value: `${inner}`, - } - }, - ]) - mdastFindReplace(tree, replacements) - } - }, - ] as PluggableList + const plug: Pluggable = (tree: Root, _path) => { + if (opts.enabled) { + const replacements: [RegExp, string | ReplaceFunction][] = [] + replacements.push([ + highlightRegex, + (_value: string, ...capture: string[]) => { + const [inner] = capture + return { + type: "html", + value: `${inner}`, + } + }, + ]) + mdastFindReplace(tree, replacements) + } + } + return plug }, htmlPlugins(_ctx) { - return [] as PluggableList + const plug: Pluggable = () => {} + return plug }, externalResources(_ctx) { const js = [] as JSResource[]