If the readme
Cargo.toml
key is set, doc.rs renders the README on the crate's index page. Is there a way to emulate this when running cargo doc
locally?
If I add:
#![doc = r###"contents
of
README.md
here
"###]
as a literal, I get the behaviour I'm looking for, but inlining a copy of my whole README.md is pretty inconvenient for making updates.
I tried:
#![doc = include!("README.md")]
but this gives an error:
error: unexpected token: `include`
--> src/lib.rs:3:10
|
3 | #![doc = include!("README.md")]
| ^^^^^^^
There is an unstable feature, external-doc
, which enables this:
Example usage (nightly-only):
#![feature(external_doc)]
#![doc(include = "../README.md")]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With