dendron: Publishing: Images do not show up with simplest publishing technique

Please select the area your bug applies to. (Multiple selections are Possible. You can leave blank if you’re not sure.)

  • Workspace. VSCode workspace, vaults, Intellisense/autocomplete, Dendron settings
  • Lookup. Dendron’s Lookup Command
  • Views. Dendron Preview, Tree View, Side Panels in the UI
  • Schema. Dendron Schemas
  • Pod. Data import from / export to Dendron
  • Publish. External Site Publish
  • Markdown. Markdown features, such as syntax support and features

Describe the bug

Images that are within the repository do NOT get shown upon publishing using the simplest method of publishing (running a local server).

To Reproduce

Create a workspace with a vault that contains vault/assets/images/my-image.png

Create a note note.md that has the following content

![img](assets/images/my-image.png)

Validate that the preview of note.md shows the image.

Go through the steps described in publish wiki https://wiki.dendron.so/notes/e5st4LFLtIwwbQmC6JBaF/

And after running the npx dendron publish export

Grab the files from .next/out/ and utilize python server to serve these files:

python -m SimpleHTTPServer 8000

Expected behavior

Image is shown in the published note.

Actual behavior: The site is being served by python -m SimpleHTTPServer 8000 (look up, searching works). But the images are shown as broken links.

Screenshots

Screen Shot 2022-04-05 at 6 33 11 PM

Desktop (please complete the following information)

  • OS: [e.g. iOS]
  • Browser (if with published websites; include version): [e.g. chrome, safari]
  • Versions (all that apply to bug):
    • Dendron Extension: 88.0
    • VS Code version:
    • Dendron CLI:

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 16 (16 by maintainers)

Most upvoted comments

@nickolay-kondratyev - I think there’s a simple workaround: prefix all your image links with a slash:

![](/assets/images/screenshot.png)

instead of

![](assets/images/screenshot.png)

Can you let me know if this works?

We have some logic in preview to make it work even if there’s no leading slash, but it looks like that logic got dropped in the publishing flow. We’ll follow up on that part.

@jonathanyeung

Here is the entire test repository with, log notes, environment recorded, and entire .next/out folder as well to record as much state as possible. Let me know if you are able to reproduce it from running from this

https://drive.google.com/file/d/1qUyh66qSsvlQ5nD4PbSRXCYON3kIYy5g/view?usp=sharing

Run this command to unpack the folder

untarUngzFile ()
{
    tar xzf "$1"
}

And place it into /tmp/ForPublishTest/ for the other command specified in [[command-used-for-publishing]] to work.

Or you can also go straight to .next/out from unpacked file an run

python -m SimpleHTTPServer 8080

@jonathanyeung are you trying the basic example from root.md note?

It appears that for me if I add an image to root.md the image is rendered but if I add the image to a note right next to root for example hi.md then the same image does not render anymore.

Due to 404 such as

10.187.170.15 - - [12/Apr/2022 03:17:34] code 404, message File not found
10.187.170.15 - - [12/Apr/2022 03:17:34] "GET /notes/9y0v9nlt6xs55ek4pb3klfe/assets/images/dendron_root_image.png.png HTTP/1.1" 404 -

Where 9y0v9nlt6xs55ek4pb3klfe is the id of the hi.md note.

If some other simple server method works better than python SimpleHTTPServer (node etc…), would be happy to use it.

Also could be good to add this method to the wiki as one of the ways to serve the published content (as this seems like the simplest way to publish, when working on internal networks).