OliverBalfour / obsidian-pandoc

Pandoc document export plugin for Obsidian (https://obsidian.md)
MIT License
692 stars 57 forks source link

Obsidian not exporting images from relative path #118

Open anutator opened 2 years ago

anutator commented 2 years ago

I try to export my article to .docx format. I can export images only if I copy them to the root folder. But I keep images in relative folder "assets":

|
--vault folder (root folder)
 --- DevOps (category folder)
  - Article1.md
  - Article2.md
  - assets   (subfolder with images)
    --- image1.png
    --- image2.png
 --- Gitlab (category folder)
   - Article3.md
   - Article4.md
   - assets  (subfolder with images)
     --- image3.png
     --- image4.png

I tried to change main.js file as it was shown on https://github.com/OliverBalfour/obsidian-pandoc/issues/81 (markdown+rebase_relative_paths) But still I don't get images. If I set in Pandoc settings Export files from HTML or Markdown — Markdown I get .docx file without images

Export files from HTML or Markdown — HTML I don't get .docx file because images from article are not found in Obsidian vault folder.

If i copy images from assets folder to vault folder I get .docx with images. But I can't do that every time — I have many images and articles.

Images are inserted in Obsidian such way: ![[zabbix-login.png]]

My settings in .obsidian/plugins/obsidian-pandoc/main.js

       case 'md': {
          const result = yield pandoc({
              file: inputFile, format: 'markdown+rebase_relative_paths',
              pandoc: this.settings.pandoc, pdflatex: this.settings.pdflatex
          }, { file: outputFile, format }, this.settings.extraArguments.split('\n'));
          error = result.error;
          command = result.command;
          break;
      }  
NoxoN1602 commented 2 years ago

Same issue here, unfortunately. This feels like an easy to fix issue or am I mistaken? Would b really nice if this was adressed

Xoffio commented 2 years ago

Same here...

vstoms commented 1 year ago

Same here.

anutator commented 1 year ago

Pandoc doesn't work with image wikilinks such as ![[image1.png]]. There are two new plugins in pandoc 3, they automatically convert URL wikilinks to markdown links, but they don't convert images. I opened an issue https://github.com/jgm/pandoc/issues/8853. As alternative I installed https://github.com/ozntel/obsidian-link-converter plugin, but I installed it manually (I didn't find it in Obsidian plugin list). At first I convert all my wikilinks from an article to markdown links: wikilinks-to-markdown

Or you can convert all vault wikilinks to markdown links. Besides you can convert markdown links to wikilinks.

And then I use Pandoc plugin to export an article to docx or epub. Pandoc Plugin Preferences: Export files from HTML or Markdown — Markdown Extra Pandoc arguments — --resource-path=assets

sruby commented 11 months ago

Pandoc doesn't work with image wikilinks such as ![[image1.png]]. There are two new plugins in pandoc 3, they automatically convert URL wikilinks to markdown links, but they don't convert images. I opened an issue jgm/pandoc#8853. As alternative I installed https://github.com/ozntel/obsidian-link-converter plugin, but I installed it manually (I didn't find it in Obsidian plugin list). At first I convert all my wikilinks from an article to markdown links: wikilinks-to-markdown

Or you can convert all vault wikilinks to markdown links. Besides you can convert markdown links to wikilinks.

And then I use Pandoc plugin to export an article to docx or epub. Pandoc Plugin Preferences: Export files from HTML or Markdown — Markdown Extra Pandoc arguments — --resource-path=assets

I always disable WikiLinks in Obsidian, in the same folder , most images can be export with docx, but part images can't be exported. warn log:

image

lyndondrake commented 8 months ago

I've just run into the same issue. Is there any plausible fix for this?

afganrasulov commented 2 months ago

Found the solution

I had the same problem, and I think I found the solution. I recorded a video to help you out. Here is the link: https://youtu.be/pKawg6mPWE4