← All repos

wrap-ansi

Wordwrap a string with ANSI escape codes

Browse cluster: Terminal & CLI Output Styling
80commits
13contributors
2languages

Tech stack & purpose

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.

Community & reference links

Languages

JavaScript
98.6%
TypeScript
1.4%

Contributors