Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mrxiaozhuox/markdown-meta-parser
Parse Markdown to Json
https://github.com/mrxiaozhuox/markdown-meta-parser
Last synced: 18 days ago
JSON representation
Parse Markdown to Json
- Host: GitHub
- URL: https://github.com/mrxiaozhuox/markdown-meta-parser
- Owner: mrxiaozhuox
- License: mit
- Created: 2022-03-16T10:14:02.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-09-09T21:41:27.000Z (about 2 years ago)
- Last Synced: 2024-10-11T01:51:05.446Z (about 1 month ago)
- Language: Rust
- Size: 14.6 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Markdown Meta Parser
Parse Markdown Metadata
```markdown
---
title: Hello World
author: mrxiaozhuox
tags: [post, test]
released: false
---# This is my first post!
Hello World!!
``````rust
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());
``````text
(
{
"author": String(
"mrxiaozhuox",
),
"tags": Array(
[
"post",
"test",
],
),
"released": Bool(
false,
),
"title": String(
"Hello World",
),
},
"\n# This is my first post!\n\nHello World!!\n",
),
```