| Crates.io | rustdoc-md |
| lib.rs | rustdoc-md |
| version | 0.1.0 |
| created_at | 2025-03-17 14:49:40.623776+00 |
| updated_at | 2025-03-17 14:49:40.623776+00 |
| description | Convert Rust documentation JSON into clean, organized Markdown files |
| homepage | |
| repository | https://github.com/tqwewe/rustdoc-md |
| max_upload_size | |
| id | 1595574 |
| size | 154,626 |
Convert Rust documentation JSON into clean, organized Markdown.
rustdoc-md transforms the JSON output from rustdoc into a comprehensive, well-structured Markdown document. This makes your Rust API documentation easily shareable in contexts where HTML documentation isn't ideal, such as GitHub wikis, embedding in other documents, or sharing with AI assistants.
cargo install rustdoc-md
The JSON output format is currently a nightly-only feature, but you can use it on stable Rust with the RUSTC_BOOTSTRAP=1 environment variable:
# On nightly Rust:
RUSTDOCFLAGS="-Z unstable-options --output-format json" cargo doc --no-deps
# On stable Rust (using bootstrap):
RUSTC_BOOTSTRAP=1 RUSTDOCFLAGS="-Z unstable-options --output-format json" cargo doc --no-deps
This will generate JSON documentation in your target/doc directory.
rustdoc-md --path target/doc/your_crate.json --output api_docs.md
You can also use rustdoc-md as a library in your Rust projects:
use rustdoc_md::{rustdoc_json_to_markdown, rustdoc_json_types::Crate};
use std::fs;
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Load the JSON file
let json_path = "target/doc/your_crate.json";
let data: Crate = serde_json::from_reader(
fs::File::open(json_path)?
)?;
// Convert to Markdown
let markdown = rustdoc_json_to_markdown(data);
// Save the Markdown file
fs::write("api_docs.md", markdown)?;
println!("Documentation converted successfully!");
Ok(())
}
This crate is compatible with rustdoc JSON format version 42. The format may change in future Rust releases as it's still considered unstable.
For tracking the latest rustdoc JSON schema changes, see the rustdoc-json-types repository.
MIT or Apache-2.0, at your option.