diff --git a/app/Polysemy/Commonmark/AST.hs b/app/Polysemy/Commonmark/AST.hs index 2493dc5..cdfb5a8 100644 --- a/app/Polysemy/Commonmark/AST.hs +++ b/app/Polysemy/Commonmark/AST.hs @@ -96,7 +96,7 @@ data BlockPiece = Paragraph Inline | BlockQuote Block | CodeBlock Text Text | Heading Int Inline - | ReferenceLinkDefinition { label :: Text, dest :: Text, title :: Text } + | ReferenceLinkDefinition { label, dest, title :: Text } | List ListType ListSpacing [Block] deriving stock (Show) @@ -197,7 +197,12 @@ instance PrintColor Block where for_ (zip (listPrefixes type_) blocks) \(listPrefix, block) -> do printBlockP (prefix <> listPrefix) block putTextLnO "" - printBlockOne _prefix x = error $ "printBlockOne: " <> show x + printBlockOne prefix ReferenceLinkDefinition{label, dest, title} = do + putTextO prefix + putTextO $ "[" <> label <> "]: " + withSgr [ANSI.SetUnderlining ANSI.SingleUnderline] do + putTextO dest + putTextLnO $ " " <> title listPrefixes :: ListType -> [Text] listPrefixes (BulletList c) = repeat (fromString [c, ' '])