#markdown-it #markdown-parser

markdown-it-tasklist

A markdown-it plugin for parsing GFM tasklists

5 releases

0.2.0 Aug 3, 2023
0.1.3 Jun 21, 2023
0.1.2 Jun 21, 2023
0.1.1 Jun 21, 2023
0.1.0 Jun 21, 2023

#1636 in Text processing

Download history 14/week @ 2024-07-20 66/week @ 2024-07-27 21/week @ 2024-08-03 24/week @ 2024-08-10 15/week @ 2024-08-17 15/week @ 2024-08-24 15/week @ 2024-08-31 22/week @ 2024-09-07 12/week @ 2024-09-14 30/week @ 2024-09-21 26/week @ 2024-09-28 18/week @ 2024-10-05 10/week @ 2024-10-12 162/week @ 2024-10-19 87/week @ 2024-10-26 14/week @ 2024-11-02

274 downloads per month
Used in markdown-it-gfm

Apache-2.0

8KB
108 lines

markdown-it-tasklist

crates.io

A markdown-it.rs plugin to process GFM tasklists.

- [x] foo
- [ ] bar

Usage

To load the plugin:

let parser = &mut markdown_it::MarkdownIt::new();
markdown_it::plugins::cmark::add(parser);

markdown_it_tasklist::add(parser);
// or with checkboxes disabled
// markdown_it_tasklist::add_disabled(parser);

let ast  = parser.parse("- [x] foo");
let html = ast.render();

lib.rs:

A [markdown_it] plugin for parsing tasklists

let parser = &mut markdown_it::MarkdownIt::new();
markdown_it::plugins::cmark::add(parser);
markdown_it_tasklist::add(parser);
let root = parser.parse("- [x] task");
let mut names = vec![];
root.walk(|node,_| { names.push(node.name()); });
assert_eq!(names, vec![
"markdown_it::parser::core::root::Root",
"markdown_it::plugins::cmark::block::list::BulletList",
"markdown_it::plugins::cmark::block::list::ListItem",
"markdown_it_tasklist::TodoCheckbox",
"markdown_it::parser::inline::builtin::skip_text::Text",
]);

Dependencies

~5–14MB
~193K SLoC