1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
//! Convert rustdoc JSON output to clean, LLM-friendly markdown documentation.
//!
//! This library provides functionality to parse rustdoc's JSON output and convert it
//! to well-formatted markdown files suitable for LLM consumption and text-based viewing.
//!
//! # Example
//!
//! ```no_run
//! use cargo_doc_md::{convert_json_file, ConversionOptions};
//! use std::path::Path;
//!
//! let options = ConversionOptions {
//! input_path: Path::new("target/doc/my_crate.json"),
//! output_dir: Path::new("docs"),
//! include_private: false,
//! };
//!
//! convert_json_file(&options).expect("Conversion failed");
//! ```
pub use rustdoc_types;
use Result;
use Path;
/// Options for converting rustdoc JSON to markdown.
/// Convert a rustdoc JSON file to markdown (multi-file output).
///
/// This is the main entry point for library usage. Generates one file per module.
///
/// # Arguments
///
/// * `options` - Configuration for the conversion
///
/// # Returns
///
/// Returns `Ok(())` on success, or an error if the conversion fails.
///
/// # Example
///
/// ```no_run
/// use cargo_doc_md::{convert_json_file, ConversionOptions};
/// use std::path::Path;
///
/// let options = ConversionOptions {
/// input_path: Path::new("target/doc/my_crate.json"),
/// output_dir: Path::new("docs"),
/// include_private: false,
/// };
///
/// convert_json_file(&options).expect("Conversion failed");
/// ```
/// Convert rustdoc JSON data (already loaded) to markdown.
///
/// Use this if you want more control over the loading and writing process.
///
/// # Arguments
///
/// * `json_data` - The rustdoc JSON as a string
/// * `include_private` - Whether to include private items
///
/// # Returns
///
/// Returns the markdown as a String, or an error.