zoni / obsidian-export

Rust library and CLI to export an Obsidian vault to regular Markdown
Other
1.05k stars 83 forks source link

Image files in embedded links being destroyed #101

Open aseem-thakar opened 2 years ago

aseem-thakar commented 2 years ago

If I link to an image using embedded wiki-links (i.e. ![[Image_link]]) instead of standard Markdown (i.e. ), it results in the image file changing to 0 bytes (and unable to be viewed) albeit with the file name still intact.

I'm experiencing this with .png files - not sure if it happens with other extensions (e.g. jpg)

ZhiyDevQAQ commented 2 years ago

yes! I have the same question!

zoni commented 2 years ago

I have links to various images in my own exported knowledgebase and have never seen/encountered this behavior. :thinking: I'll need a minimal reproduction case (example vault showing this issue) to investigate this further I'm afraid.

anutator commented 1 year ago

Pandoc 3 has new extensions, but they convert only URL wikilinks. So you have to install an additional plugin to Obsidian (I could install manually, I didn't find it in list of plugins) and convert wikilinks to markdown before export. The similar problem, read my last comment with the link to plugin. https://github.com/OliverBalfour/obsidian-pandoc/issues/118

Thompson-Jason commented 3 months ago

I am having this same issue with embedded videos (WebM).

In my vault I have

![[nameOfVideo.webm]]

and it gets exported as

[nameOfVideo.webm](pathToVideo.webm)

thus not being embedded. If I go in and manually edit the output to include the "!" prefix it works as intended. I have only experience this problem with WebM files all my gifs and images are fine.

zoni commented 3 months ago

@Thompson-Jason webm isn't registered as a filetype that's embeddable.

https://github.com/zoni/obsidian-export/blob/76c61c6a076201e20f1322ef8758ffc8197b41a0/src/lib.rs#L676

However, I don't think it's as simple as just adding webm there. Having an image element pointing to a video file seems a little unusual, and I'd expect most static site generators, Markdown-to-HTML renderers, etc. would act unpredictably with that.

Not sure what the right approach would be, and it would probably need to offer opt-in behavior. One of those strategies might be to rewrite it to an HTML video element.