git.iko.soy/typeable/pandoc
on master help sign in
Fix strikethrough in gfm writer.

Previously we got a crash, because we were trying to print a native cmark STRIKETHROUGH node, and the commonmark writer in cmark-github doesn't support this. Work around this by using a raw node to add the strikethrough delimiters. Closes #4038.

commit8e53489cbca3f230eed94294af3810d2447db2af authorJohn MacFarlane <jgm@berkeley.edu> dateSat 4 Nov 2017, 10:35 (9 years ago) parentd31a04d
2 files changed+7−1
src/Text/Pandoc/Writers/CommonMark.hs+1−1 test/command/4038.md+6
src/Text/Pandoc/Writers/CommonMark.hs+1−1
@@ -242,7 +242,7 @@ inlineToNodes opts (Emph xs) = (node EMPH (inlinesToNodes opts xs) :)
242242inlineToNodes opts (Strong xs) = (node STRONG (inlinesToNodes opts xs) :)
243243inlineToNodes opts (Strikeout xs) =
244244 if isEnabled Ext_strikeout opts
245− then (node STRIKETHROUGH (inlinesToNodes opts xs) :)
245+ then (node (CUSTOM_INLINE "~~" "~~") (inlinesToNodes opts xs) :)
246246 else ((node (HTML_INLINE (T.pack "<s>")) [] : inlinesToNodes opts xs ++
247247 [node (HTML_INLINE (T.pack "</s>")) []]) ++ )
248248inlineToNodes opts (Superscript xs) =
test/command/4038.mdnew file+6
@@ -0,0 +1,6 @@
1+```
2+% pandoc -f gfm -t gfm
3+# ~~Header~~
4+^D
5+# ~~Header~~
6+```