-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
cargo-doc: enable using --html-in-header and other rustdoc flags #331
Comments
We've tried avoiding just exposing the entire CLI of a tool as it makes deterministic builds nearly impossible. What exactly do you have in mind for these sorts of flags? Things like html-in-header we could certainly add support for! |
Adding a custom stylesheet, or a githuh ribbon |
Oh ok, you mentioned that there may be other rustdoc flags you were interested in, but is |
Looking at |
Though perhaps these would be better in a configuration file than as command line flags in the first place. |
We've been talking about just adding a frontmatter, I forget the issue #. |
@steveklabnik What’s a frontmatter? |
I would suggest that this be closed in favor of that. |
If understand correctly, rust-lang/rust#16178 is about adding metadata to a single Markdown file. I’d like to add stuff (e.g. a CSS stylesheet) to every documentation page of a given project, including pages generated by rustdoc for a Rust item. |
I guess I'd expect that ticket to cover some sort of 'layout' as well, |
Yes, the idea is that the frontmatter will lead rustdoc to support layouts. So you could have: ---
layout: main
title: "Foo bar"
keywords: ["foobar", "123"]
--- And ---
layout: guide
title: "Foo bar"
keywords: ["foobar", "123"]
--- However, this doesn't exactly solve the auto-generating API docs. We could introduce a ...
[doc]
logo = "http://.../logo.png"
stylesheets = ["doc/index.css", "doc/base/index.css"] Not sure if the complexity is worth it, but it could come in handy at times. |
Whatever a "layout" is, I’d still want a default one project-wide, that I wouldn’t have to specify in every file. |
Of course. |
I tend to agree that I would rather this be configuration in-source rather than command lines to rustdoc. The tool at fault here is arguably rustdoc rather than cargo. If the documentation doesn't look good unless you pass a set of flags, then the documentation shouldn't be able to be built without those sets of flags. We may want to extend the crate-level |
👍 I've ran into this myself while trying to move from Makefiles to cargo :(
This isn't the problem I have. The standard documentation looks good, but has Rust's style, not my project's style. I'd like to add a custom header, because I want to customize the output and tinker with CSS and HTML, e.g. I hate webfonts, but I don't want to be arguing with you whether webfonts are good for all documentations of all Rust projects everywhere. I just want to hack the output to remove them from my project only. I don't understand why deterministic builds of documentation are important, even in projects that require deterministic build of binaries. But if it matters, why the solution can't be "don't use unpredictable custom flags" or maybe add I suppose something like that in
or
would be an OK solution. |
I landed here trying to implement the workaround in rust-lang/rust#15347 (which is probably going to get closed "behaves correctly" due to the fact that you can pass flags to rustdoc that solve the problem). Basically, I want to pass, for development purposes,
to rustdoc (but not ship those flags to users). I think cargo should have support for that, either as a high-level |
I know +1 comments are usually frowned upon, but I'd like to re-up this feature request. There's been a lot of discussion about metadata and custom css and so on, but my interest is purely in finding a way to add the "Fork me on Github" snippet to my docs during |
This is relevant as well when trying to render mathematical formulas in the documentation: the |
Maybe it should be an attribute in the rust code, rather than an option in the Cargo.toml, just like |
By the way, it can already be done using 'html injection' through the
😉 |
I'm running into this because I want to generate rustdocs for my test code. To do that I'd like to use |
For my sanity: the feature request here is to allow configuring this per-crate in Cargo.toml or as an attribute, cargo already lets you do this globally with RUSTDOCFLAGS or when building your own crate yourself with |
This got "fixed" at some point, and the |
Another option is to set
in |
I filed rust-lang/rust#95 to enable the specific case of |
Currently I see no way of doing this. Perhaps it should be
Cargo.toml
configuration keys?The text was updated successfully, but these errors were encountered: