rustdocumentationrustdoc

How is it possible to keep Rust module documentation in separate Markdown files?


This section of the Rust book seems to imply that it is possible to keep Rust documentation in separate .md files, but it does not say how these .md files can then be included back. How does this work?


Solution

  • It doesn't. That section on describing the functionality of rustdoc is saying that it can process individual .md files. The third paragraph touches on this:

    Documentation can be generated in two ways: from source code, and from standalone Markdown files.

    Insofar as I am aware, there is no extant way to put code documentation in external files. It would be theoretically possible to do so using a procedural derive macro, but I'm not aware of any crate that actually does this.