| Crates.io | rustdoc-markdown |
| lib.rs | rustdoc-markdown |
| version | 0.91.0 |
| created_at | 2026-01-13 00:24:09.621336+00 |
| updated_at | 2026-01-13 00:24:09.621336+00 |
| description | A tool to convert Rust documentation to Markdown, for use with LLMs |
| homepage | |
| repository | https://github.com/Dooyo-Labs/rustdoc-markdown |
| max_upload_size | |
| id | 2039102 |
| size | 375,006 |
This crate extracts documentation from crates.io packages and renders it into a monolithic markdown document.
The initial use case was for generating documentation context for large language models.
In some places the markdown is not technically valid since some headers nest higher than the h6 level, but it's assumed an LLM would benefit more from the consistent structure.
As a trade-off that reduces the size of the output, but makes the documentation of types more indirect, there is support for rolling up "Common Traits" for the crate and for each module so that the list of implemented traits, per-type, can be more concise. This feature can be disabled.
If a package contains a README.md and examples in an examples/ directory,
these are also folded into the documentation.
Install:
cargo install rustdoc-markdown
Generate Markdown for rustdoc-types version 0.39.0:
rustdoc-markdown print rustdoc-types 0.39.0 --output rustdoc-types-api.md
Generate Markdown for a local crate:
rustdoc-markdown print my-local-crate --manifest path/to/my-local-crate/Cargo.toml --output my-local-crate-api.md
rustdoc-markdown can also be used as a library to integrate documentation generation
into other tools.
See the library documentation for rustdoc_markdown::Printer
for an example of how to:
rustdoc to get the rustdoc_types::Crate data.Printer to generate the Markdown documentation.One awkward paper cut with the rustdoc-markdown CLI is that the --build-dir
option cannot point within a Cargo project/ workspace, due to the way it needs
to unpack and inspect packages from crates.io.
The problem is that Cargo will unconditionally walk up the filesystem looking
for Cargo.toml files to find the workspace root and it will get confused while
trying to inspect a package if it then finds an un-related Cargo.toml above
it.
By default the --build-dir will be set to a temporary directory like
/tmp/rust-markdown-<crate_name> to avoid this problem.
Ideally though Cargo should have some mechanism for limiting how far up the filesystem it searches for workspaces so that it's possible to sandbox it's behavior.
Ref:
It depends on:
nightly-2025-11-22 Rust toolchain.rustdoc-types version 0.57.See the changelog for rustdoc-types for compatibility information when updating the toolchain:
https://github.com/rust-lang/rustdoc-types/blob/trunk/CHANGELOG.md
This project aims to have it's minor version track the minor version of the most recent stable Rust release that's aligned with the nightly toolchain it depends on.
Licensed under either of
at your option.