đź“ťPretty-Printing
I believe all pretty-printing algorithms are generic and can layout anything (that has fixed width) on any mostly fixed-width unbound height medium.
A prettier printer — Philip Wadler #paper
Beware that this algorithm exploits laziness of Haskell. Implementing it in a strict language leads to exponentially growing complexity. For strict languages, see [ Strictly Pretty #paper | from Pretty-Printing]
extension of Wadler’s one
wl-pprint-extras: A free monad based on the Wadler/Leijen pretty printer
further extension of the Leijen one
ansi-wl-pprint: The Wadler/Leijen Pretty Printer for colored ANSI terminal output
prettyprinter: A modern, easy to use, well-documented, extensible pretty-printer.
Pretty Printing — Helmut Brandl #paper
pretty-printing in strict language. Wadler semantics
another strict pretty-printer in OCaml
This one is easier to follow and it seems to be one used in [prettier/prettier-printer | from Pretty-Printing]
PPrint: A Universal Pretty-Printer
A general pretty-printing library in Racket
early version of the prettier seems to be inspired by Wadler and has some additional features.
Compact, Streaming Pretty-Printing of Hierarchical Data: a Pretty-Printing algorithm by Haoyi used in scala’s PPrint: http://www.lihaoyi.com/PPrint/
Might be not robust enough for pretty-printing code (but good enough for printing data). Also, nice ideas on making pretty-printer streaming.