| Crates.io | md2data |
| lib.rs | md2data |
| version | 0.1.4 |
| created_at | 2025-12-01 08:51:09.935372+00 |
| updated_at | 2025-12-01 09:33:17.944249+00 |
| description | CLI and library for converting Markdown → JSON/YAML/TOML/XML |
| homepage | |
| repository | https://github.com/jenul-ferdinand/md2data |
| max_upload_size | |
| id | 1959533 |
| size | 55,032 |
Markdown → JSON/YAML/TOML/XML. Faster with Rust.
Add to your Cargo.toml:
[dependencies]
md2data = "0.1"
Or use cargo add:
cargo add md2data
By default, only JSON support is enabled. Enable other formats as needed:
[dependencies]
md2data = { version = "0.1", features = ["yaml", "toml", "xml"] }
use md2data::{convert_str, OutputFormat, ParsingMode};
fn main() {
let markdown = r#"# Hello World
This is a **markdown** document."#;
// Convert to different formats
let json = convert_str(markdown, OutputFormat::Json, ParsingMode::Minified).unwrap();
let yaml = convert_str(markdown, OutputFormat::Yaml, ParsingMode::Minified).unwrap();
let toml = convert_str(markdown, OutputFormat::Toml, ParsingMode::Minified).unwrap();
let xml = convert_str(markdown, OutputFormat::Xml, ParsingMode::Minified).unwrap();
println!("{}", json);
}
ParsingMode::Minified (default): Compact representationParsingMode::Document: Full document structure with detailed node informationThe build process can be initiated with cargo build.