ink-ansi
v1.0.0
Published
Safely print text using ink even when it may contain ansi escape sequences
Downloads
2,336
Readme
ink-ansi
An alternative text component that avoids rendering control characters that mess with the layout in ink. It unfortunately also strips out any emoji, because ink is not able to correctly measure & thus layout text that includes emoji.
This is useful if you want to render the output of other terminal applications.
Demo
The demo in src/demo.tsx renders this
On the left is what gets rendered by ink-ansi. You can see it mosty maintaining the correct layout. On the right is what is rendered with Ink's built in Text element. The control sequences, newlines, tabs etc. all break the layout.
Installation
yarn add ink-ansi
Usage
import AnsiText from 'ink-ansi';
// use <AnsiText> anwywhere you previously used <Text>