Skip to content
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

Create RFC for bundling local images in rustdoc output #3

Closed
wants to merge 13 commits into from

Conversation

GuillaumeGomez
Copy link
Owner

@GuillaumeGomez GuillaumeGomez commented Feb 6, 2023

text/000-rustdoc-bundle-local-resources.md Outdated Show resolved Hide resolved
text/000-rustdoc-bundle-local-resources.md Show resolved Hide resolved
text/000-rustdoc-bundle-local-resources.md Outdated Show resolved Hide resolved
text/000-rustdoc-bundle-local-resources.md Show resolved Hide resolved
text/000-rustdoc-bundle-local-resources.md Show resolved Hide resolved
* Add new entry for foreign items inlining.
* Mention problem of packages size increase
* Add unresolved questions about support for logo and favicon
…on this RFC

* Change how cross-crate inlining will be handled

The only local resources considered will be the ones in the markdown image syntax: `![resource title](path)`, where `<path>` is the path of the resource file relative to the source file.

The path could be either a relative path (`../images/my_image.png`) or an absolute path (like `/home/user/project/images/my_image.png` or `C:/Users/user/project/images/my_image.png`) so that paths can be constructed using `OUT_DIR`:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After the confusion in Zulip, this probably needs to be a bit more explicit about the motivation here:

Suggested change
The path could be either a relative path (`../images/my_image.png`) or an absolute path (like `/home/user/project/images/my_image.png` or `C:/Users/user/project/images/my_image.png`) so that paths can be constructed using `OUT_DIR`:
The path could be any relative or absolute file path. For example, to include an image generated by [`build.rs`](https://doc.rust-lang.org/cargo/reference/build-scripts.html), concatenate a path with the `OUT_DIR` environment variable:

text/000-rustdoc-bundle-local-resources.md Outdated Show resolved Hide resolved

If the path isn't referring to a file, a warning will be emitted and rustdoc will left the path unchanged in the generated documentation.

For published crates, <docs.rs> builds the contents of the `.crate` package in a sandbox with no internet access. Make sure any resources your docs need are [included](https://doc.rust-lang.org/cargo/reference/manifest.html#the-exclude-and-include-fields) in the package.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
For published crates, <docs.rs> builds the contents of the `.crate` package in a sandbox with no internet access. Make sure any resources your docs need are [included](https://doc.rust-lang.org/cargo/reference/manifest.html#the-exclude-and-include-fields) in the package.
For published crates, [docs.rs] builds the contents of the `.crate` package in a sandbox with no internet access. Make sure any resources your docs need are [included](https://doc.rust-lang.org/cargo/reference/manifest.html#the-exclude-and-include-fields) in the package.


The local resources files are not affected by the `--resource-suffix`.

The impact on >docs.rs> would also be very minimal as the size of a published crate resources is limited to a few megabytes. The only thing needed would be to handle the new `doc.files` folder.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The impact on >docs.rs> would also be very minimal as the size of a published crate resources is limited to a few megabytes. The only thing needed would be to handle the new `doc.files` folder.
The impact on [docs.rs] would also be very minimal as the size of a published crate resources is limited to a few megabytes. The only thing needed would be to handle the new `doc.files` folder.

text/000-rustdoc-bundle-local-resources.md Show resolved Hide resolved
@GuillaumeGomez
Copy link
Owner Author

I fixed the links and added the explanation for cross-crate inlined images.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants