cargo-readme
cargo-readme copied to clipboard
Generate rustdoc from README?
My project uses #![doc = include_str!("../README.md")] to generate the rustdoc for the crate from its README. However, I noticed a user forked it just to remove this line, ostensibly since they're using a Rust version < 1.54.
Does this crate support this opposite direction for the doc generation? For example, outputting rustdoc comments to stdout, or automatically replacing src/lib.rs rustdoc with the result.
I suppose I can also just convert the markdown to rustdoc manually, but I'm curious about a tool for this. Thanks!
@seanpianka I can't speak of this crate, but what you can do is feature-gat that include_str! of yours:
#![cfg_attr(feature = "better-docs",
cfg_attr(all(), doc = include_str!("../README.md")),
)]
with some better-docs = [] feature in your crate which can be enabled by docs.rs:
[features]
# ...
better-docs = [] # unstable
[package.metadata.docs.rs]
features = ["better-docs"]