File: README.md

package info (click to toggle)
haskell-doclayout 0.4.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 252 kB
  • sloc: haskell: 1,179; makefile: 3
file content (30 lines) | stat: -rw-r--r-- 873 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# doclayout

[![CI
tests](https://github.com/jgm/doclayout/workflows/CI%20tests/badge.svg)](https://github.com/jgm/doclayout/actions)

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:

``` haskell
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.