doclayout: A prettyprinting library for laying out text documents.

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

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]

Properties

Versions 0.1, 0.2, 0.2.0.1, 0.3, 0.3.0.1, 0.3.0.2, 0.3.1, 0.3.1.1, 0.4, 0.4.0.1, 0.4.0.1, 0.5
Change log changelog.md
Dependencies base (>=4.12 && <5), containers, emojis (>=0.1.2), mtl, safe, semigroups (>=0.18 && <0.19), text [details]
License BSD-3-Clause
Copyright 2016-19 John MacFarlane
Author John MacFarlane
Maintainer jgm@berkeley.edu
Category Text
Home page https://github.com/jgm/doclayout
Source repo head: git clone https://github.com/jgm/doclayout
Uploaded by JohnMacFarlane at 2023-03-26T04:35:50Z

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Readme for doclayout-0.4.0.1

[back to package description]

doclayout

CItests

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.

Example:

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.