question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Relative images in markdown files no longer being processed

See original GitHub issue

I recently upgraded from astro-imagetools 0.5.8 to 0.6.10 (and astro from beta 17 to 44) and since then my relative images seemingly are no longer processed.

I’m talking about things like ![Alt](./assets/settings.png "Dm Settings") in pure .md markdown files.

In the past this would end up as something like:

<picture class="astro-imagetools-picture astro-imagetools-picture-8F238379" style="position: relative; display: inline-block; max-width: 100%; height: auto; --z-index:1; --opacity:0;"><source srcset="/assets/settings@320w.9b3eee5d.avif 320w, /assets/settings@632w.7a64b477.avif 632w" sizes="(min-width: 632px) 632px, 100vw" width="632" height="407" type="image/avif">
<source srcset="/assets/settings@320w.7fd6123e.webp 320w, /assets/settings@632w.ea069f5e.webp 632w" sizes="(min-width: 632px) 632px, 100vw" width="632" height="407" type="image/webp">
<img src="/assets/settings@632w.dcd55824.png" alt="Alt" srcset="/assets/settings@320w.aa82ff1d.png 320w, /assets/settings@632w.dcd55824.png 632w" sizes="(min-width: 632px) 632px, 100vw" width="632" height="407" loading="lazy" decoding="async" class="astro-imagetools-img" style="display: inline-block; overflow: hidden;max-width: 100%; height: auto;" onload="parentElement.style.setProperty('--z-index', 1);parentElement.style.setProperty('--opacity', 0);">
  </picture>

but now it ends up as <img src="./assets/settings.png"> which is not where the image is and thus gives a 404.

You can see this live in action here. There should be a missing image: image

The sourcecode for that page can be found here (It’s not a super big repository).

You can still see the old behaviour here which is an output from this PR in which I originally added astro to my site. (You can see the netlify output by clicking on the view details button)

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:1
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
ChauhanTcommented, Aug 4, 2022

Hi, I am trying the markdown syntax. The relative paths do not seem to work at all! I’m on astro rc.4. I think the relative paths get picked up, but they are not rendered properly. In the file /writing/2021/random-title/random-title.md, if I have a ![random alt](./image.png), instead of an image, what is rendered is the text:

${renderComponenteb618d57($$result, "Pictureeb618d57", Pictureeb618d57, { "src": "/writing/2021/random-title/image.png", "alt": "random alt" })}

It broke after I updated my packages with npm update. Any advice on what might be going on and how to fix it?

1reaction
Krupteincommented, Jul 1, 2022

Is this still happening @Kruptein ?

As far as I can see, there hasn’t been a new release? If so, then yes 😄 I’ve downgraded to 0.5 for now

Read more comments on GitHub >

github_iconTop Results From Across the Web

github markdown no longer displays images - Stack Overflow
It looks like the images were linked to a relative path in your repository. You earlier had an images/ directory with the images...
Read more >
Image link in markdown with relative link not working with sphinx
I have markdown files that reference png images in a separate folder. ... root location of the markdown file that is being processed...
Read more >
CCS: The Markdown viewer does not take relative paths to ...
I am trying to create a md file in a ccs project which has images with relative links. The markdown file when viewed...
Read more >
Markdown reference for Microsoft Learn - Contributor guide
In most cases, the next action link will be a relative link to another file in the same docset. Non-localized strings. You can...
Read more >
Overview - Zola
All non-Markdown files you add in a page/section directory will be copied alongside the generated page when the site is built, which allows...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found