Wordwrap a string with ANSI escape codes
Browse cluster: Terminal & CLI Output Styling →wrap-ansi is a JavaScript library that wordwraps strings while preserving ANSI escape codes, which are commonly used for terminal text styling and colors. The project handles the complexity of wrapping text that contains ANSI codes by normalizing newlines, expanding tabs, and providing options for hard wrapping, word wrapping, and whitespace trimming. It's designed to work with styled strings, such as those created by the chalk library, and is installed via npm.