doclayout: A prettyprinting library for laying out text documents.

[ bsd3, library, text ] [ Propose Tags ]

doclayout is a prettyprinting library for laying out text documents, with several features not present in prettyprinting libraries designed for code. It was designed for use in pandoc.

[Skip to Readme]
Versions [faq] 0.1, 0.2,, 0.3
Change log
Dependencies base (>=4.9 && <5), mtl, safe, semigroups (==0.18.*), text [details]
License BSD-3-Clause
Copyright 2016-19 John MacFarlane
Author John MacFarlane
Category Text
Home page
Source repo head: git clone
Uploaded by JohnMacFarlane at 2019-10-23T03:18:11Z
Distributions Arch:0.3, Fedora:0.3, NixOS:0.3, openSUSE:0.3
Downloads 5842 total (452 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2019-10-23 [all 1 reports]


[Index] [Quick Jump]


Maintainer's Corner

For package maintainers and hackage trustees

Readme for doclayout-0.2

[back to package description]


This is a prettyprinting library designed for laying out plain-text documents. It originated in the pandoc module Text.Pandoc.Pretty, and its development has been guided by pandoc's needs in rendering wrapped textual documents.

In supports wrapping of text on breaking spaces, indentation and other line prefixes, blank lines, and tabular content.


Text.DocLayout> mydoc = hang 2 "- " (text "foo" <+> text "bar")
Text.DocLayout> putStrLn $ render (Just 20) mydoc
- foo bar
Text.DocLayout> putStrLn $ render (Just 10) (prefixed "> " (mydoc $+$ mydoc))
> - foo
>   bar
> - foo
>   bar

The Doc type may be parameterized to either String or (strict or lazy) Text, depending on the desired render target.