Render ReferenceLinkDefinition

main
staticvoid 2022-06-27 21:42:42 +03:00
parent 8aa18bfcf7
commit d465f223ef
1 changed files with 7 additions and 2 deletions

View File

@ -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, ' '])