include_documentation!() { /* proc-macro */ }Expand description
Includes a markdown file with relative .md links rewritten to rustdoc intra-doc links.
This macro reads a markdown file at compile time (relative to CARGO_MANIFEST_DIR)
and rewrites same-directory .md links to point at crate::docs::module_name
submodules, making cross-document links work in rendered rustdoc output.
§Syntax
ⓘ
#![doc = include_documentation!("docs/hkt.md")]path: A string literal path to a markdown file, relative toCARGO_MANIFEST_DIR.
§Generates
A string literal containing the file contents with rewritten links.
Same-directory .md links are converted to rustdoc intra-doc link references;
all other links are left unchanged.
§Examples
ⓘ
// Invocation
#![doc = include_documentation!("docs/hkt.md")]
// Link rewriting:
// [text](./foo-bar.md) -> [text][crate::docs::foo_bar]
// [text](foo-bar.md) -> [text][crate::docs::foo_bar]
// [text](../other.md) -> unchanged (contains path separator)
// [text](https://...) -> unchanged (not .md)