From eaac39444af9ad2bd9c363f7d3e60f5d9bbcfd47 Mon Sep 17 00:00:00 2001 From: sss Date: Fri, 21 Feb 2025 01:19:38 +0100 Subject: [PATCH] prettier --- quartz/plugins/transformers/ofm.ts | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/quartz/plugins/transformers/ofm.ts b/quartz/plugins/transformers/ofm.ts index f34f0a195..58fb64616 100644 --- a/quartz/plugins/transformers/ofm.ts +++ b/quartz/plugins/transformers/ofm.ts @@ -220,19 +220,27 @@ export const ObsidianFlavoredMarkdown: QuartzTransformerPlugin> if (opts.inlineFootnotes) { // Replaces ^[inline] footnotes with regular footnotes [^1]: const footnotes: Record = {} - + // Replace inline footnotes with references and collect definitions - const result = (src as string).replace(inlineFootnoteRegex, (_match: string, content: string) => { - const id = `inline-${Math.random().toString(36).substring(2, 8)}` - footnotes[id] = content.trim() - return `[^${id}]` - }) + const result = (src as string).replace( + inlineFootnoteRegex, + (_match: string, content: string) => { + const id = `inline-${Math.random().toString(36).substring(2, 8)}` + footnotes[id] = content.trim() + return `[^${id}]` + }, + ) // Append footnote definitions if we found any if (Object.keys(footnotes).length > 0) { - return result + "\n\n" + Object.entries(footnotes) - .map(([id, content]) => `[^${id}]: ${content}`) - .join("\n") + "\n" + return ( + result + + "\n\n" + + Object.entries(footnotes) + .map(([id, content]) => `[^${id}]: ${content}`) + .join("\n") + + "\n" + ) } return result