#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

#2821 in Parser implementations

Download history 184/week @ 2024-10-25 240/week @ 2024-11-01 228/week @ 2024-11-08 181/week @ 2024-11-15 207/week @ 2024-11-22 157/week @ 2024-11-29 195/week @ 2024-12-06 342/week @ 2024-12-13 84/week @ 2024-12-20 103/week @ 2024-12-27 117/week @ 2025-01-03 313/week @ 2025-01-10 248/week @ 2025-01-17 178/week @ 2025-01-24 273/week @ 2025-01-31 266/week @ 2025-02-07

1,034 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
~198K SLoC