jxnblk / mdx-go

:zap: Lightning fast MDX-based dev server for progressive documentation

Home Page:https://mdx-go.now.sh

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support Sub-Resources URLs for images

gwildu opened this issue · comments

Would be great, if you could put images you'd like to refer to in an article right inside the folder where the file for the article is and then refer to it with a sub-resource URL as described here under "Relative URLs": https://developer.mozilla.org/en-US/docs/Learn/Common_questions/What_is_a_URL#examples_of_relative_urls

You already support such Routes for links to other articles, but not for images, so it would also be consistent.

File Structure:

- root
  - main
    - sub
      - index.mdx
      - image.png

image markdown:

![my image](image.png)

Just figured out how that would work.
The issue I had, was, that I was not putting the ending / in the link for that article: sub instead of sub/, which then of course was leading to the wrong base path for the sub-resource URL.
Sorry for the disturbance.

Sorry again, but now I figured out, that the trailing / in the link is by default stripped from the href attribute somewhere, so it would be great, if you could keep those trailing slashes so we could also use sub-resource urls for images or also deliver images the same way as you deliver articles because there it is not an issue when the trailing / is missing...

Link Markdown

[sub](sub/)

resulting HTML

<a href="sub/">sub</a>