Socket
Socket
Sign inDemoInstall

ink-ansi

Package Overview
Dependencies
49
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ink-ansi

Safely print text using ink even when it may contain ansi escape sequences


Version published
Weekly downloads
1.4K
increased by4.97%
Maintainers
2
Created
Weekly downloads
 

Readme

Source

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.

Build Status Rolling Versions NPM version

Demo

The demo in src/demo.tsx renders this

GIF showing ink-ansi fixing inconsistent rendering

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>

FAQs

Last updated on 11 Nov 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc