diff options
author | Sebastian Wiesner <sebastian@swsnr.de> | 2019-03-30 19:10:06 +0100 |
---|---|---|
committer | Sebastian Wiesner <sebastian@swsnr.de> | 2019-03-30 19:10:06 +0100 |
commit | d75218d57d89b3d7352d1ace353f2225dca447bd (patch) | |
tree | 6463b3bc3cb4160867a00952210b33be10ef40a0 /src | |
parent | f41dfc6a1c3753f59d2f099b1cdbfe491c380eb3 (diff) |
Render strike through text
Closes GH-71
Diffstat (limited to 'src')
-rw-r--r-- | src/lib.rs | 7 | ||||
-rw-r--r-- | src/main.rs | 1 |
2 files changed, 6 insertions, 2 deletions
@@ -589,7 +589,10 @@ fn start_tag<'io, 'c, 'l, W: Write>( } FootnoteDefinition(_) => panic!("mdcat does not support footnotes"), Table(_) | TableHead | TableRow | TableCell => panic!("mdcat does not support tables"), - Strikethrough => panic!("mdcat does not support strikethrough"), + Strikethrough => { + let style = ctx.style.current.strikethrough(); + ctx.set_style(style) + } Emphasis => ctx.enable_emphasis(), Strong => { let style = ctx.style.current.bold(); @@ -709,7 +712,7 @@ fn end_tag<'io, 'c, 'l, W: Write>( ctx.end_inline_text_with_margin()? } FootnoteDefinition(_) | Table(_) | TableHead | TableRow | TableCell => {} - Strikethrough => panic!("mdcat does not support strikethrough"), + Strikethrough => ctx.drop_style(), Emphasis => { ctx.drop_style(); ctx.style.emphasis_level -= 1; diff --git a/src/main.rs b/src/main.rs index 582cf1f..6d306b3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -60,6 +60,7 @@ fn process_arguments(size: TerminalSize, args: Arguments) -> Result<(), Box<dyn let (base_dir, input) = read_input(&args.filename)?; let mut options = Options::empty(); options.insert(Options::ENABLE_TASKLISTS); + options.insert(Options::ENABLE_STRIKETHROUGH); let parser = Parser::new_ext(&input, options); if args.dump_events { |