Front Matter parser for Rust.
Add this crate as a dependency:
toml
[dependencies]
fronma = "~0.1"
then use fronma::parser::parse
to parse text that has YAML Front Matter:
```rust use fronma::parser::parse; use serde::Deserialize;
struct Headers { title: String, }
fn main() { let text = r#"---
B "#;
let data = parse::<Headers>(text).unwrap();
assert_eq!(data.headers.title, "A");
assert_eq!(data.body, "B\n");
} ```
This library supports the following Front Matter formats:
default
feature)toml
feature)json
feature)For example, when you want to use TOML format, add this crate with toml feature:
toml
[dependencies]
fronma = { version = "~0.1", features = ["toml"] }
then use fronma::parser::parse_with_engine
like this:
```rust use fronma::engines::Toml; use fronma::parser::parsewithengine; use serde::Deserialize;
struct Headers { title: String, }
fn main() { let text = r#"---
dummybody
"#;
let result = parsewithengine::