Skip to content

Commit

Permalink
Revert "Try to fix wikilink-embed e2e tests by returning md content i…
Browse files Browse the repository at this point in the history
…nstead of html content"

This reverts commit 2598689.
  • Loading branch information
badsketch committed Aug 22, 2023
1 parent 2598689 commit 35536c5
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions packages/foam-vscode/src/features/preview/wikilink-embed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ export const markdownItWikilinkEmbed = (
? inlineFormatter
: cardFormatter;

const rawContent = extractor(includedNote, parser, workspace);
content = formatter(rawContent, md);
content = extractor(includedNote, parser, workspace);
html = formatter(content, md);
break;
}
case 'attachment':
Expand All @@ -71,14 +71,15 @@ export const markdownItWikilinkEmbed = (
${md.renderInline('[[' + wikilink + ']]')}<br/>
Embed for attachments is not supported
</div>`;
html = md.render(content);
break;
case 'image':
content = `<div class="embed-container-image">${md.render(
`![](${md.normalizeLink(includedNote.uri.path)})`
)}</div>`;
html = md.render(content);
break;
}
html = md.render(content);
refsStack.pop();
return html;
} catch (e) {
Expand Down Expand Up @@ -167,11 +168,13 @@ function fullExtractor(
export type EmbedNoteFormatter = (content: string, md: markdownit) => string;

function cardFormatter(content: string, md: markdownit): string {
return `<div class="embed-container-note">${md.render(content)}</div>`;
return md.render(
`<div class="embed-container-note">${md.render(content)}</div>`
);
}

function inlineFormatter(content: string, md: markdownit): string {
return content;
return md.render(content);
}

export default markdownItWikilinkEmbed;

0 comments on commit 35536c5

Please sign in to comment.