Skip to main content

doc_include

Macro doc_include 

Source
doc_include!() { /* 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 = doc_include!("docs/hkt.md")]
  • [text](./foo-bar.md) becomes [text][crate::docs::foo_bar]
  • [text](foo-bar.md) becomes [text][crate::docs::foo_bar]
  • Links with path separators (../, subdirectories) are left unchanged.
  • Non-.md links are left unchanged.