1{-# LANGUAGE FlexibleInstances #-} 2{-# LANGUAGE OverloadedStrings #-} 3module Commonmark.Extensions.Strikethrough 4 ( HasStrikethrough(..) 5 , strikethroughSpec ) 6where 7import Commonmark.Types 8import Commonmark.Syntax 9import Commonmark.Inlines 10import Commonmark.SourceMap 11import Commonmark.Html 12 13strikethroughSpec :: (Monad m, IsBlock il bl, IsInline il, HasStrikethrough il) 14 => SyntaxSpec m il bl 15strikethroughSpec = mempty 16 { syntaxFormattingSpecs = [ 17 FormattingSpec '~' True True Nothing (Just strikethrough) '~' 18 ] 19 } 20 21class HasStrikethrough a where 22 strikethrough :: a -> a 23 24instance HasStrikethrough (Html a) where 25 strikethrough x = htmlInline "del" (Just x) 26 27instance (HasStrikethrough i, Monoid i) 28 => HasStrikethrough (WithSourceMap i) where 29 strikethrough x = (strikethrough <$> x) <* addName "strikethrough" 30