I created a custom solution for rendering embeds in Obsidian-rendered markdown. Here’s the source code in my repeat plugin: obsidian-repeat-plugin/markdown.ts at ad2097cde7c337a2ee04b48083cd12e0d680b5a2 · prncc/obsidian-repeat-plugin · GitHub
The basic idea is to first render with MarkdownPreviewView.renderMarkdown
and then fix broken embeds (with direct DOM manipulations) using a sequence of cases like:
const embedType = determineEmbedType(node);
if (embedType === EmbedType.Image) {
const img = createEl('img');
img.src = getMediaUri(
vault,
node.getAttribute('src') as string,
sourcePath);
node.empty();
node.appendChild(img);
}
The tricky part is figuring out the URLs.
At this time, I only embed PDFs on desktops because it looks like mobile Obsidian uses native-systems to embed PDFs and it wasn’t worth the time investment to support a feature I don’t use that much. Also, I don’t recursively render notes embedded in the embedded note, although it wouldn’t be to complicated to do so.