Crates.io | markdown-it-front-matter |
lib.rs | markdown-it-front-matter |
version | 0.3.0 |
source | src |
created_at | 2023-06-14 00:18:35.700091 |
updated_at | 2023-08-03 16:55:49.52753 |
description | A markdown-it plugin for parsing front matter |
homepage | |
repository | https://github.com/chrisjsewell/markdown-it-plugins.rs |
max_upload_size | |
id | 889567 |
size | 18,171 |
A markdown-it.rs plugin to process front matter containers.
let parser = &mut markdown_it::MarkdownIt::new();
markdown_it_front_matter::add(parser);
let ast = parser.parse("---\nfoo: bar\n---\n");
print!("{:#?}", ast.children);
// [
// Node {
// children: [],
// srcmap: Some(
// (
// 0,
// 16,
// ),
// ),
// ext: NodeExtSet(
// {},
// ),
// attrs: [],
// node_type: markdown_it_front_matter::FrontMatter,
// node_value: FrontMatter {
// content: "foo: bar\n",
// },
// },
// ]
Essentially, valid front matter is a fenced block:
---
---
valid-front-matter: true
---