#plugin #markdown #markdown-it #spoiler

markdown-it-block-spoiler

A markdown-it plugin for parsing block spoilers

2 stable releases

1.0.1 Dec 13, 2024
1.0.0 Sep 12, 2024

#1727 in Parser implementations

Download history 93/week @ 2024-09-07 41/week @ 2024-09-14 11/week @ 2024-09-21 8/week @ 2024-09-28 2/week @ 2024-10-05 2/week @ 2024-10-12 23/week @ 2024-10-19 218/week @ 2024-10-26 231/week @ 2024-11-02 242/week @ 2024-11-09 168/week @ 2024-11-16 203/week @ 2024-11-23 136/week @ 2024-11-30 294/week @ 2024-12-07 265/week @ 2024-12-14 51/week @ 2024-12-21

774 downloads per month

GPL-3.0 license

16KB
105 lines

License Latest version Downloads for latest version

markdown-it-block-spoiler.rs

A markdown-it plugin to process block spoliers.

To load the plugin:

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

markdown_it_block_spoiler::add(&mut parser);

let html = parser.parse("::: spoiler _click to see more_\nhow spicy!\n:::\n").xrender();
assert_eq!(html, String::from("<details><summary>_click to see more_</summary>how spicy!\n</details>\n"));

lib.rs:

A markdown-it plugin to process block spoliers.

To load the plugin:

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

markdown_it_block_spoiler::add(&mut parser);

let html = parser.parse("::: spoiler _click to see more_\nhow spicy!\n:::\n").xrender();
assert_eq!(html, String::from("<details><summary>_click to see more_</summary>how spicy!\n</details>\n"));

Dependencies

~6–14MB
~200K SLoC