Crates.io | markdown-meta-parser |
lib.rs | markdown-meta-parser |
version | 0.1.3 |
source | src |
created_at | 2022-03-18 05:06:59.608495 |
updated_at | 2022-09-09 21:41:35.841529 |
description | parse markdown metadata |
homepage | |
repository | https://github.com/mrxiaozhuox/markdown-meta-parser/ |
max_upload_size | |
id | 552533 |
size | 9,541 |
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",
),