From f127f93f92f0d82ef10f9aed9d9e238e134620ee Mon Sep 17 00:00:00 2001 From: bptato Date: Mon, 5 Feb 2024 15:34:31 +0100 Subject: md2html: add support for strikethrough --- adapter/format/md2html.nim | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'adapter/format/md2html.nim') diff --git a/adapter/format/md2html.nim b/adapter/format/md2html.nim index cd9cebab..8e623585 100644 --- a/adapter/format/md2html.nim +++ b/adapter/format/md2html.nim @@ -45,7 +45,7 @@ proc getId(line: openArray[char]): string = inc i type InlineState = enum - isItalic, isBold, isCode, isComment + isItalic, isBold, isCode, isComment, isDel const AsciiAlphaNumeric = {'0'..'9', 'A'..'Z', 'a'..'z'} proc parseInline(line: openArray[char]) = @@ -105,6 +105,12 @@ proc parseInline(line: openArray[char]) = elif c == '`': state.incl(isCode) append "" + elif c == '~' and i + 1 < line.len and line[i + 1] == '~': + if state.toggle(isDel): + append "" + else: + append "" + inc i elif c == '!' and bs == bsNone and i + 1 < line.len and line[i + 1] == '[': image = true elif c == '[' and bs == bsNone: -- cgit 1.4.1-2-gfad0