mdoc-0.1.0.0: src/Mdoc/Pretty/MdocLine.hs
-- |
--
-- Module : Mdoc.Pretty.MdocLine
-- Copyright : (c) 2026 Patrick Brisbin
-- License : AGPL-3
-- Maintainer : pbrisbin@gmail.com
-- Stability : experimental
-- Portability : POSIX
module Mdoc.Pretty.MdocLine
( prettyMdocLine
) where
import Mdoc.Prelude
import Mdoc.MdocLine
import Mdoc.Pretty
import Mdoc.Pretty.Interpolation
import Mdoc.Pretty.MacroArg
import Mdoc.Pretty.MacroName
import Mdoc.Pretty.TableLine
import Mdoc.Pretty.TroffMacro
prettyMdocLine :: MdocLine -> Doc Ann
prettyMdocLine = \case
Comment x -> annotate AnnComment $ ".\\\" " <> pretty x
MacroLine name args ->
hsep
$ annotate AnnComment "."
<> annotate AnnCommand (prettyMacroName name)
: map prettyMacroArg args
TextLine x -> pretty x
TableLines ls -> prettyTableLines ls
TroffMacro m -> prettyTroffMacro m
InterpolatedLine i -> prettyInterpolation i