Skip to content

Relative URLs in subdirectory readmes #3484

Closed
@clehner

Description

@clehner

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:

  1. Resolve relative to the homepage property rather than the repository property.
  2. Add a readme_url metadata field, to use as the base URL for resolution.
  3. 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.

Metadata

Metadata

Assignees

Labels

A-backend ⚙️C-enhancement ✨Category: Adding new behavior or a change to the way an existing feature works

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions