obsidian-pandoc icon indicating copy to clipboard operation
obsidian-pandoc copied to clipboard

fix missing images in export

Open dirkroorda opened this issue 3 years ago • 9 comments

See the comments in the code.

Test it before applying it, since I did not do any building-bundling whatsoever.

dirkroorda avatar Jun 22 '22 14:06 dirkroorda

Fix looks sensible to me.

@OliverBalfour could you look this over? It doesnt look like a very high risk change at all.

Image rendering images in the Obsidian Pandoc flow are affecting many people, this looks like it might solve a bunch of them.

People reporting (likley related) image exporting Issues: https://github.com/OliverBalfour/obsidian-pandoc/issues/66 https://github.com/OliverBalfour/obsidian-pandoc/issues/81 https://github.com/OliverBalfour/obsidian-pandoc/issues/95 https://github.com/OliverBalfour/obsidian-pandoc/issues/118 https://github.com/OliverBalfour/obsidian-pandoc/issues/138

https://forum.obsidian.md/t/how-to-pass-image-directory-location-to-pandoc/33349 https://forum.obsidian.md/t/pandoc-does-not-show-embedded-images-in-docx/27209

evolve2k avatar Oct 20 '22 22:10 evolve2k

@OliverBalfour I can see you've worked on this a bit as discussed in your Future Directions post.

I reviwed your patch code, and this change is separate from what you've already done.

@dirkroorda dirkroorda thanks for this patch, could you clean up and remove all the comments except for the code change lines, that'll make it easier for someone to just hit MERGE. I think here is the best place for disclaimers and workflow discussions, as you've done. Would be good to get this in if it's such a small simple fix and as you said it's working for you.

evolve2k avatar Oct 20 '22 22:10 evolve2k

@evolve2k Hi Richie, just did it.

dirkroorda avatar Oct 21 '22 17:10 dirkroorda

Looking forward to this update

fuhadabdulla avatar Oct 22 '22 01:10 fuhadabdulla

Is there something missing here or could we merge this? This would improve my workflow a lot! Thanks for your work! 🙂

kw90 avatar Nov 23 '22 13:11 kw90

@OliverBalfour? Can you help us all out.

Hoping it's a very easy merge now. It's a 2 line change.

evolve2k avatar Nov 23 '22 23:11 evolve2k

It seems this patch only works for markdown mode, not html mode, referring to the below lines:

https://github.com/OliverBalfour/obsidian-pandoc/blob/68ff9e3733cc73055156455721fc736ad45c7d5e/main.ts#L106-L146

Interpause avatar Nov 28 '22 10:11 Interpause

So, the problem is pulling the path information from the file object when passing the .md file. It looks like the current code passes the raw HTML from stdin, which lacks path data. So a potential fix would be to generate a temporary HTML file in the directory of the input file, then remove it once the export is complete. It's kind of awkward but it solves the problem from the pandoc command line point of view?

EllriNidhogg avatar Nov 30 '22 16:11 EllriNidhogg

Will this patch allow for images in PDF and odt too?

MavropaliasG avatar Apr 08 '23 14:04 MavropaliasG