obsidian-enhancing-export icon indicating copy to clipboard operation
obsidian-enhancing-export copied to clipboard

Markdown-Hugo: Option to put images in the same directory as exported file

Open aviskase opened this issue 11 months ago • 0 comments

Hi. Currently, when running export to markdown-hugo, the end result for me looks like this:

➜ tree
.
├── scratchpad
│   └── 5802d43f298e15b95cbc5caf2a9a2116c2660b59.png
└── scratchpad.md

scratchpad.md content:

<figure>
<span class="image placeholder"
data-original-image-src="../scratchpad/5802d43f298e15b95cbc5caf2a9a2116c2660b59.png"
data-original-image-title="wikilink">histomf.png</span>
<figcaption>histomf.png</figcaption>
</figure>

Here is my command setup:

-f ${fromFormat}  --resource-path="${currentDir}" --resource-path="${vaultDir}/${attachmentFolderPath}" --lua-filter="${luaDir}/markdown+hugo.lua" --lua-filter admonition.lua -s -o "${outputPath}" -t commonmark_x-attributes
  1. I'm not sure it's correct behavior to go up ../scratchpad. I'd expect ./scratchpad
  2. In my hugo blog all images are stored in the same directory as the markdown file. So the expected result is:
➜ tree
.
├── 5802d43f298e15b95cbc5caf2a9a2116c2660b59.png
└── scratchpad.md

scratchpad.md content:

<figure>
<span class="image placeholder"
data-original-image-src="./5802d43f298e15b95cbc5caf2a9a2116c2660b59.png"
data-original-image-title="wikilink">histomf.png</span>
<figcaption>histomf.png</figcaption>
</figure>

Is it possible to achieve this with some kind of export options or it needs to be implemented as an option in the plugin? If the latter, I'm happy to work on PR, my guess is that I need to change something in markdown.lua and add setting somewhere.

aviskase avatar Mar 13 '24 14:03 aviskase