vernak2539 / astro-rehype-relative-markdown-links

Rehype Plugin for Astro that allows for usage of relative links between markdown files
https://www.npmjs.com/package/astro-rehype-relative-markdown-links
12 stars 4 forks source link

bug: Incorrectly transforming directory paths (e.g,, ./test.md) #12

Closed techfg closed 6 months ago

techfg commented 6 months ago

When a url is pointing to directory rather than a file, the url is being transformed.

For example, in a directory structure such as

.
├── src/
│   ├── content/
│   │   ├── posts/
│   │   |   ├── archive.md/
│   │   |   |   └── index.md
│   │   |   └── post-1.md

The following markdown in src/content/posts/post-1.md strips archive.md

Markdown: [Archive Index](./archive.md)
Transformed url: `/posts/archive`

Repro:

With Proposed Fixes from PR #21:

Steps to reproduce:

  1. Open repro
  2. Click on Post 1 link
  3. Click on either link under Repro for Issue #12

Expected Result: Link should navigate to /posts/archive.md and show the index page

Actual Result: md is stripped and link results in 404

Additional Info: You can see all links that Astro generates on home page under Issue #12 heading

techfg commented 6 months ago

FYI - Edited OP to a Stackblitz to the repro that contains the proposed fixes from #21.

vernak2539 commented 6 months ago

Released in v0.8.1. Thanks!

techfg commented 6 months ago

Awesome, ty!