markdown_it/plugins/extra/
strikethrough.rs

1//! Strikethrough syntax (like `~~this~~`)
2use crate::generics::inline::emph_pair;
3use crate::{MarkdownIt, Node, NodeValue, Renderer};
4
5#[derive(Debug)]
6pub struct Strikethrough {
7    pub marker: char
8}
9
10impl NodeValue for Strikethrough {
11    fn render(&self, node: &Node, fmt: &mut dyn Renderer) {
12        fmt.open("s", &node.attrs);
13        fmt.contents(&node.children);
14        fmt.close("s");
15    }
16}
17
18pub fn add(md: &mut MarkdownIt) {
19    emph_pair::add_with::<'~', 2, true>(md, || Node::new(Strikethrough { marker: '~' }));
20}