titleFromPandoc :: Pandoc -> Either TitleError Text
titleFromPandoc (P.Pandoc _ blocks) =
  case blocks of
    P.Header _ _ inlines : _ ->
        first CantWriteTitle
      . P.runPure
      $ P.writePlain writerOptions (P.Pandoc mempty [P.Plain inlines])
    _ -> Left DoesntStartWithHeader
titleFromPandoc :: Pandoc -> Either TitleError Text
titleFromPandoc (P.Pandoc _ blocks) =
  case blocks of
    P.Header _ _ inlines : _ ->
        first CantWriteTitle
      . P.runPure
      $ P.writePlain writerOptions (P.Pandoc mempty [P.Plain inlines])
    _ -> Left DoesntStartWithHeader
titleFromPandoc (P.Pandoc _ blocks) =
  case blocks of
    P.Header _ _ inlines : _ ->
        first CantWriteTitle
      . P.runPure
      $ P.writePlain writerOptions (P.Pandoc mempty [P.Plain inlines])
    _ -> Left DoesntStartWithHeader