This issue can be seen here, with the "examples/" link: https://crates.io/crates/finchers
Basically, GitHub allows links to folders and files within the repo, and those links don't work on crates.io. This seems pointy, although I am not sure how best to resolve it.
As a first pass, transforming relative URLs to URLs relative to the repository might make sense.
This is tricky; it won't work well in 100% of cases because a repository URL might be something like <https://github.com/kivikakk/blah>, but the URL to a file in that repository is like <https://github.com/kivikakk/blah/blob/master/file.md>.
We can assume that the main branch is master and so just always prepend {repository}/blob/master/ and we'll get the 95% case fixed, which is way better than the current situation (a bunch of broken links).
Edit: of course, this is super GitHub-specific. We could do this only in the case that the repository URL contains ://github.com/, and look up some other patterns for the other big public hosts?
Edit 2: looks like the same style works for GitLab and Bitbucket, so maybe this is OK.
A proposal implementing the above is at https://github.com/rust-lang/crates.io/pull/1131. There's an ammonia-related caveat I'll see if I can get support from upstream for a fix.
This should now be fixed; the example at <https://crates.io/crates/finchers> will be once we rerender READMEs.
I have a weird behavior on https://crates.io/crates/git-changelog
Links in the original readme are written like this:
A commit [like this](src/assets/sample-commit.message)
github converts them as
<p>A commit <a href="/aldrin/git-changelog/blob/master/src/assets/sample-commit.message">like this</a>
this</a>.</p>
creates.io generates
<a href="https://github.com/aldrin/git-changelog/blob/master/resources/sample-commit.message" rel="nofollow noopener noreferrer">like this</a>
Hi @benoittgt, could you open a new issue please?
Actually nevermind, I saw the comment saying "this should be fixed" and thought this issue was closed. This is fine!
I'll have a look into this shortly!
I've tested locally that the following test passes:
#[test]
fn relative_link_test() {
assert_eq!(
markdown_to_html("A commit [like this](src/assets/sample-commit.message) generates an output [like this](src/assets/sample.md).", Some(&"https://github.com/aldrin/git-changelog")).unwrap(),
"<p>A commit <a href=\"https://github.com/aldrin/git-changelog/blob/master/src/assets/sample-commit.message\" rel=\"nofollow noopener noreferrer\">like this</a> generates an output <a href=\"https://github.com/aldrin/git-changelog/blob/master/src/assets/sample.md\" rel=\"nofollow noopener noreferrer\">like this</a>.</p>\n");
}
So where on earth is the substring replacement of src/assets to resources happening? The uploaded README has the replacements already made.
I've published the crate to a locally-running server and have confirmed everything is working OK — the generated README has the correct links. Is there something about crates.io's production setup that could be causing this substitution? Maybe something with CloudFront?

Oh, hold the phone, I'm mistaken. It _is_ a link to resources/… in 0.2.1: https://github.com/aldrin/git-changelog/blame/v0.2.1/README.md#L9-L10
There hasn't been a release since it was changed to src/assets in https://github.com/aldrin/git-changelog/commit/76dbed62a40980d47f84b9ca82e1b72b391e7af0. 😅