The tracking issue for this feature is: #44732
external_doc feature allows the use of the
include parameter to the
#[doc] attribute, to
include external files in documentation. Use the attribute in place of, or in addition to, regular
doc comments and
#[doc] attributes, and
rustdoc will load the given file when it renders
documentation for your crate.
With the following files in the same directory:
# My Awesome Type This is the documentation for this spectacular type.
#![feature(external_doc)] #[doc(include = "external-doc.md")] pub struct MyAwesomeType;
rustdoc will load the file
external-doc.md and use it as the documentation for the
When locating files,
rustdoc will base paths in the
src/ directory, as if they were alongside the
lib.rs for your crate. So if you want a
docs/ folder to live alongside the
start your paths with
rustdoc to properly find the file.