A prettyprinting library for laying out text documents.
|LTS Haskell 20.15:||0.4@rev:1|
|Stackage Nightly 2023-03-20:||0.4@rev:1|
|Latest on Hackage:||0.4@rev:1|
Maintained by email@example.com
This version can be pinned in stack with:
Module documentation for 0.4
Depends on 6 packages(full list with versions):
Used by 6 packages in lts-20.8(full list with versions):
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
Doc type may be parameterized to either
(strict or lazy)
Text, depending on the desired render target.
isEmojiJoiner[API change] (Stephen Morgan).
- Add new exported functions
isZWJ[API change] (Stephen Morgan).
- Drop support for ghc <= 8.4, add test for ghc 9.2.
- Don’t collapse the CarriageReturn + Newline combination (#20). We want to ensure that a literal starting with a Newline doesn’t lose the newline if it occurs after a CarriageReturn. This affects code blocks in pandoc that begin with newlines.
- Improve performance of NoShortcut code (Stephen Morgan).
- Simplify emoji processing (Stephen Morgan).
- Add benchmarking for code with no shortcuts (Stephen Morgan).
- Add unicodeWidth.inc to cabal file.
updateColumnso they don’t re-render.
- Get unicode block widths directly from the Unicode specification, rather than writing it out ourselves (Stephen Morgan).
- Resolve the width of ambiguous characters based on their context (Stephen Morgan).
- Spacing marks should have nonzero width, even though they are combining characters (Stephen Morgan).
- Add shortcuts for extended Latin, Arabic, Cyrillic, Greek, Devangari, Bengali, Korean, Telugu, and Tamil (Stephen Morgan).
- Fix location of extra-source-files in cabal.
- update.hs: require text package
- Handle emoji variation modifiers specially, so the keypad emoji can be ignored (Stephen Morgan). This results in a 16% speedup of realLength on ascii text.
- Add benchmarks for all scripts used by more than 50 million people, plus a couple more. (#9, Stephen Morgan).
- Fix the end of the block of zero width characters which contains the zero-width joiners and directional markings (Stephen Morgan, #5). This fixes a regression introduced in 0.3.1, affecting code points 0x2010 to 0x2030.
- Improved handling of emojis. Emojis are double-wide, but
previously this library did not treat them as such. We now
have comprehensive support of emojis, including variation
modifiers and zero-width joiners, verified by a test suite.
Performance has been confirmed to be no worse for text without emojis.
(Stephen Morgan, #1). API changes: export
fromString(#2, sjakobi). This produces a further reduction in allocations and pandoc compile time.
fromString(#1). @sjakobi reports that this change reduced total allocations for building pandoc-2.12 with GHC 8.10.4 by 8.5% and reduced peak allocations are reduced from 3854MB to 3389MB.
- Add foldlChar to signature of HasChars [API change].
- Use foldlChar in realLength. This avoids a stack overflow we were getting with long strings in the previous version (with foldrChar). See jgm/pandoc#6031.
- Replace isBlank with isBreakable and improved startsWithBlank. Previously isBlank was used in the layout algorithm where what we really wanted was isBreakable.
- Avoid unnecessary calculation in updateColumns.
- Replace a right fold with a strict left fold.
- Add strictness annotations in realLength and updateColumn.
realLengthsmarter about combining characters. If a string starts with a combining character, that character takes up a width of 1; if the combining character occurs after another character, it takes 0. See jgm/pandoc#5863.
isBlank, re-use in rendering code
- Fixed incorrect
Textwidth in renderig blocks.
- Add instances for
text, but polymorphic).
- Change some
- Add some default definitions for methods in
minOffsetto be more efficient (in simple cases they no longer render and count line lengths).
- Fix problem with
chopis invoked. This caused very strange behavior in which text got reversed in certain circumstances.
- Initial release.