Description
During readme markdown rendering, links with relative URLs in a crate's readme are resolved relative to the repository root, even if the crate and its readme file are in a subdirectory of the repository. This breaks consistency with how relative URLs are resolved in the source site - relative to the file in the subdirectory.
An example of a repository with multiple crates in subdirectories (using absolute URLs in the readmes):
https://github.com/RustCrypto/elliptic-curves/
An example of a crate published from a subdirectory using relative URLs in the readme which are rendered broken:
https://crates.io/crates/ssi-contexts/0.0.2
while in the source code they are working:
https://github.com/spruceid/ssi/blob/ssi-contexts%2F/v0.0.2/contexts/README.md
It would be nice if relative URLs could be used in subdirectory readmes. Possible solutions:
- Resolve relative to the
homepage
property rather than therepository
property. - Add a
readme_url
metadata field, to use as the base URL for resolution. - Add a
repository_path
metadata field that would be the path of the crate in the repository - where the readme is assumed to reside - for use in evaluating relative URLs in the readme.