diff options
author | bptato <nincsnevem662@gmail.com> | 2024-02-05 15:34:31 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2024-02-05 15:34:31 +0100 |
commit | f127f93f92f0d82ef10f9aed9d9e238e134620ee (patch) | |
tree | 96d6a9f3ec0b2044c763ccfa80c835a395bbf416 /adapter | |
parent | de4f007f1aaf3df25fd46839be76fc900a389d84 (diff) | |
download | chawan-f127f93f92f0d82ef10f9aed9d9e238e134620ee.tar.gz |
md2html: add support for strikethrough
Diffstat (limited to 'adapter')
-rw-r--r-- | adapter/format/md2html.nim | 8 |
1 files changed, 7 insertions, 1 deletions
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 "<CODE>" + elif c == '~' and i + 1 < line.len and line[i + 1] == '~': + if state.toggle(isDel): + append "<DEL>" + else: + append "</DEL>" + inc i elif c == '!' and bs == bsNone and i + 1 < line.len and line[i + 1] == '[': image = true elif c == '[' and bs == bsNone: |