From 2598689609e070298ba454679f834869e315be8a Mon Sep 17 00:00:00 2001 From: badsketch Date: Mon, 21 Aug 2023 23:02:48 -0400 Subject: [PATCH] Try to fix wikilink-embed e2e tests by returning md content instead of html content --- .../src/features/preview/wikilink-embed.ts | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/packages/foam-vscode/src/features/preview/wikilink-embed.ts b/packages/foam-vscode/src/features/preview/wikilink-embed.ts index a25232e6e..cad65698f 100644 --- a/packages/foam-vscode/src/features/preview/wikilink-embed.ts +++ b/packages/foam-vscode/src/features/preview/wikilink-embed.ts @@ -61,8 +61,8 @@ export const markdownItWikilinkEmbed = ( ? inlineFormatter : cardFormatter; - content = extractor(includedNote, parser, workspace); - html = formatter(content, md); + const rawContent = extractor(includedNote, parser, workspace); + content = formatter(rawContent, md); break; } case 'attachment': @@ -71,15 +71,14 @@ export const markdownItWikilinkEmbed = ( ${md.renderInline('[[' + wikilink + ']]')}
Embed for attachments is not supported `; - html = md.render(content); break; case 'image': content = `
${md.render( `![](${md.normalizeLink(includedNote.uri.path)})` )}
`; - html = md.render(content); break; } + html = md.render(content); refsStack.pop(); return html; } catch (e) { @@ -168,13 +167,11 @@ function fullExtractor( export type EmbedNoteFormatter = (content: string, md: markdownit) => string; function cardFormatter(content: string, md: markdownit): string { - return md.render( - `
${md.render(content)}
` - ); + return `
${md.render(content)}
`; } function inlineFormatter(content: string, md: markdownit): string { - return md.render(content); + return content; } export default markdownItWikilinkEmbed;