Relative URLs in readme markdown starting with `./` render broken
See original GitHub issueRelative URLs in readme markdown starting with ./
should link to files within the package, but incorrectly deno.land renders them as if they are deno.land/x packages.
Here is an example readme with broken relative URLs (the top logo SVG, and various links to package modules):
https://deno.land/x/ruck@v1.0.0
Similar to a past issue (that was apparently fixed) for relative URLs that don’t start with ./
:
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Relative link in readme broken if readme viewed automatically ...
The repo contains a README.md file. Within this README.md file I have a link so another .md file which is located in the...
Read more >Relative urls in readme.md files only work half the time ... - Jira
I've confirmed that the problem with relative links only works if the readme is rendered at a specific commit. If it is rendered...
Read more >Relative links in markup files - The GitHub Blog
Product. Relative links in markup files. We show rendered markup in several places on GitHub, most notably including a project's main README ......
Read more >GitLab Flavored Markdown (GLFM)
The text is rendered with a set of styles. These styles are called GitLab Flavored Markdown. For example, in Markdown, an unordered list...
Read more >Links and Cross References | DocFX website - NET
Please note that the file path in include syntax is handled differently than Markdown link. You can only use relative path to specify...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It seems that in DisplayFile.tsx when rendering a markdown file the baseUrl prop is missing.
https://github.com/denoland/dotland/blob/46462c8a3c3ca830d49dfa110f26d3231231d334/components/FileDisplay.tsx#L114-L127
However in Markdown.tsx the baseUrl prop is optional but later is used to call the gfm function.
https://github.com/denoland/dotland/blob/46462c8a3c3ca830d49dfa110f26d3231231d334/components/Markdown.tsx#L4-L16
As part of the solution, I tried to add the baseUrl prop, but it still doesn’t work
Conclusion
It seems that the problem is related to the gfm function that treats the markdown. This is a dependency linked to crowlKats/deno-gfm repo. There are some custom changes to the links. A think here is where the problem is.
https://github.com/crowlKats/deno-gfm/blob/663b1cc026ac881b2fe8928f157db0126ee08dba/mod.ts#L29-L34
I might be misunderstanding the code, but it looks like maybe the operation done here also needs to be done on the
baseURL
passed toFileDisplay
:https://github.com/denoland/dotland/blob/fe5cec62951471a242a719a386fd20d33e4c5de1/components/DocView.tsx#L43