Relative URL replacement breaks links to directories
Environment
n/a
Reproduction
See https://unjs.io/packages/magicast, specifically the links to the source code and test cases near the bottom highlighted here. Navigating to these links (https://raw.githubusercontent.com/unjs/magicast/main/src/helpers or https://raw.githubusercontent.com/unjs/magicast/main/test/helpers) will result in a 404 page.
Describe the bug
The original issue was that relative links did not work outside Github, see https://github.com/unjs/ungh/issues/24 which was resolved by https://github.com/unjs/ungh/pull/52.
The solution was to replace the relative URLs with absolute ones, essentially prefixing with 'https://raw.githubusercontent.com', this works fine for images/assets but does not work for directories. As seen on magicast docs, ./src/helpers is replaced with https://raw.githubusercontent.com/unjs/magicast/main/src/helpers.
Not sure how this can be resolved 🤔 I'm assuming checking each URL for a 404 would be a bit too much. Maybe checking for file extensions? But some file links have no extension like LICENSE.
Additional context
No response
Logs
No response
Hey thanks for the detailed issue. I'm little bit occupied to check this more in details, but just a quick idea, maybe wn limit rewrite of #52 to assets(images) which have different markdown?
(also /cc @cpreston321 he might have some idea too)
Ah I somehow assumed these URLs looked the same 🤦, but of course images use html img tags. This should be resolved by #95, though if there are other types of assets I'm unaware of to take into account, do let me know.