-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[rustdoc, request] Please bundle local relative resources (favicon, logo, whatever) #79254
Comments
This would be fantastic. It's been very annoying because we use a private GitHub repo, so our offline documentation just shows broken images. That also means we can't even confirm the links are correct before committing. |
Copying over from my comment at #102083:
Note that any solution that doesn't bundle the images into the crate runs into problems because (a) |
Bundling images for dependencies will massively increase the size of the .rlib metadata, even when building without rustdoc, which means this would be a giant compile-time hit across the ecosystem. Bundling would be have to be done by rustc itself, because rustdoc can't generate metadata. |
I don't understand why this is a problem. With your proposal, where this only supports |
Right, I was talking about including assets in the crates.io package, not the .rlib metadata. |
For some of my crates I have a favicon and logo within the repo but have to point to them via public links like this:
What I would love (and have long wanted) is if I could simply refer to the files with a relative path like this...:
#![doc(html_logo_url = "../../logo.png", html_favicon_url = "../../favicon.ico")]
...and
cargo doc
would then bundle them into the set of generated documentation files, such that when viewing the documentation offline locally, these resources are loaded from thetarget/doc/
directory, and for the docs.rs copy, docs.rs would serve them along with the rest of the page components.This would include the following advantages:
Perhaps this could be applied to all such local relatively referenced image resources (others too?), not just favicon and logo, to cover situations where repos include images to embed in docs.
The text was updated successfully, but these errors were encountered: