4 releases

0.1.3 Sep 9, 2022
0.1.2 Sep 9, 2022
0.1.1 Mar 18, 2022
0.1.0 Mar 18, 2022

#11 in #parse-markdown


Used in 2 crates

MIT license

8KB
142 lines

Markdown Meta Parser

Parse Markdown Metadata

---
title: Hello World
author: mrxiaozhuox<mrxzx.info@gmail.com>
tags: [post, test]
released: false
---

# This is my first post!

Hello World!!

let content = String::from("....");

let mut type_mark = HashMap::new();

type_mark.insert("tags".into(), "array");
type_mark.insert("released".into(), "bool");


let meta = MetaData {
    content,
    required: vec!["title".to_string()],
    type_mark,
}

println!("{:#?}", meta.parse().unwrap());
(
    {
        "author": String(
            "mrxiaozhuox<mrxzx.info@gmail.com>",
        ),
        "tags": Array(
            [
                "post",
                "test",
            ],
        ),
        "released": Bool(
            false,
        ),
        "title": String(
            "Hello World",
        ),
    },
    "\n# This is my first post!\n\nHello World!!\n",
),

Dependencies

~135KB