#markdown #markdown-it #parser

markdown-it-deflist

A markdown-it plugin for parsing definition lists

3 releases (breaking)

0.3.0 Aug 3, 2023
0.2.0 Jun 28, 2023
0.1.1 Jun 28, 2023

#2806 in Parser implementations

Download history 25/week @ 2024-06-17 13/week @ 2024-06-24 5/week @ 2024-07-01 7/week @ 2024-07-08 8/week @ 2024-07-15 9/week @ 2024-07-22 37/week @ 2024-07-29 12/week @ 2024-08-05 16/week @ 2024-08-12 9/week @ 2024-08-19 17/week @ 2024-08-26 6/week @ 2024-09-02 20/week @ 2024-09-09 15/week @ 2024-09-16 38/week @ 2024-09-23 19/week @ 2024-09-30

92 downloads per month

Apache-2.0

13KB
227 lines

markdown-it-deflist.rs

crates.io

A markdown-it.rs plugin to process definition lists.

It is based on the pandoc definition:

Term 1

:   Definition 1

Term 2 with *inline markup*

:   Definition 2

        { some code, part of Definition 2 }

    Third paragraph of definition 2.

See the tests for more examples.

Usage

let parser = &mut markdown_it::MarkdownIt::new();
markdown_it::plugins::cmark::add(md);
markdown_it_deflist::add(parser);
parser.parse("term\n: definition").render();
// <dl>\n<dt>term</dt>\n<dd>definition</dd>\n</dl>\n

lib.rs:

Plugin to parse definition lists

let md = &mut markdown_it::MarkdownIt::new();
markdown_it::plugins::cmark::add(md);
markdown_it_deflist::add(md);
assert_eq!(
    md.parse("term\n: definition").render(),
    "<dl>\n<dt>term</dt>\n<dd>definition</dd>\n</dl>\n"
);

Dependencies

~5–13MB
~183K SLoC