packages feed

mdoc-0.1.0.0: src/Mdoc.hs

-- |
--
-- Module      : Mdoc
-- Copyright   : (c) 2026 Patrick Brisbin
-- License     : AGPL-3
-- Maintainer  : pbrisbin@gmail.com
-- Stability   : experimental
-- Portability : POSIX
module Mdoc
  ( Mdoc (..)
  , parseMdoc
  , prettyMdoc
  ) where

import Mdoc.Prelude

import Mdoc.MdocLine
import Mdoc.Parse
import Mdoc.Parse.MdocLine
import Mdoc.Pretty
import Mdoc.Pretty.MdocLine

newtype Mdoc = Mdoc
  { lines :: [MdocLine]
  }
  deriving stock (Eq, Generic, Show)
  deriving newtype (Monoid, Semigroup)

parseMdoc :: Parser Mdoc
parseMdoc = Mdoc <$> sepEndBy parseMdocLine eol

prettyMdoc :: Mdoc -> Doc Ann
prettyMdoc mdoc = vsep $ map prettyMdocLine mdoc.lines