Installations
npm install @cocalc/ansi-to-react
Developer Guide
Typescript
Yes
Module System
CommonJS
Node Version
18.15.0
NPM Version
9.5.0
Score
80.4
Supply Chain
91.7
Quality
77.4
Maintenance
100
Vulnerability
100
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
TypeScript (98.27%)
JavaScript (1.73%)
Developer
sagemathinc
Download Statistics
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
GitHub Statistics
1 Stars
118 Commits
3 Forks
2 Watching
1 Branches
Package Meta Information
Latest Version
7.0.0
Package Id
@cocalc/ansi-to-react@7.0.0
Unpacked Size
9.42 kB
Size
3.61 kB
File Count
4
NPM Version
9.5.0
Node Version
18.15.0
Publised On
24 Mar 2023
Total Downloads
Cumulative downloads
Total Downloads
0
Last day
0%
0
Compared to previous day
Last week
0%
0
Compared to previous week
Last month
0%
0
Compared to previous month
Last year
0%
0
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
2
ansi-to-react
This package convert ANSI escape codes to formatted text output for React.
Installation
$ npm install ansi-to-react
Usage
Basic
The example below shows how we can use this package to render a string with ANSI escape codes.
1import Ansi from "ansi-to-react"; 2 3export function () => { 4 return <Ansi> 5 {'\u001b[34mhello world'} 6 </Ansi>; 7};
Will render:
1<code> 2 <span style="color:rgb(0, 0, 187)">hello world</span> 3</code>
Classes
Style with classes instead of style
attribute.
1<Ansi useClasses>{"\u001b[34mhello world"}</Ansi>
Will render
1<code> 2 <span class="ansi-blue-fg">hello world</span> 3</code>
Class Names
Font color | Background Color |
---|---|
ansi-black-fg | ansi-black-bg |
ansi-red-fg | ansi-red-bg |
ansi-green-fg | ansi-green-bg |
ansi-yellow-fg | ansi-yellow-bg |
ansi-blue-fg | ansi-blue-bg |
ansi-magenta-fg | ansi-magenta-bg |
ansi-cyan-fg | ansi-cyan-bg |
ansi-white-fg | ansi-white-bg |
ansi-bright-black-fg | |
ansi-bright-red-fg | |
ansi-bright-green-fg | |
ansi-bright-yellow-fg | |
ansi-bright-blue-fg | |
ansi-bright-magenta-fg | |
ansi-bright-cyan-fg | |
ansi-bright-white-fg |
Development
To develop on this project, fork and clone this repository on your local machine. Before making modifications, install the project's dependencies.
$ npm install
To run the test suite for this project, run:
$ npm test
Documentation
We're working on adding more documentation for this component. Stay tuned by watching this repository!
Support
If you experience an issue while using this package or have a feature request, please file an issue on the issue board,
License
No vulnerabilities found.
No security vulnerabilities found.