Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ansi-to-react

Package Overview
Dependencies
Maintainers
18
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ansi-to-react - npm Package Compare versions

Comparing version 6.0.5-alpha.0 to 6.0.5

__tests__/index.spec.tsx

0

lib/index.d.ts

@@ -0,0 +0,0 @@ /// <reference types="react" />

2

lib/index.js

@@ -115,4 +115,4 @@ "use strict";

const { className, useClasses, children, linkify } = props;
return React.createElement("code", { className }, ansiToJSON((children !== null && children !== void 0 ? children : ""), (useClasses !== null && useClasses !== void 0 ? useClasses : false)).map(convertBundleIntoReact.bind(null, (linkify !== null && linkify !== void 0 ? linkify : false), (useClasses !== null && useClasses !== void 0 ? useClasses : false))));
return React.createElement("code", { className }, ansiToJSON(children !== null && children !== void 0 ? children : "", useClasses !== null && useClasses !== void 0 ? useClasses : false).map(convertBundleIntoReact.bind(null, linkify !== null && linkify !== void 0 ? linkify : false, useClasses !== null && useClasses !== void 0 ? useClasses : false)));
}
exports.default = Ansi;
{
"name": "ansi-to-react",
"version": "6.0.5-alpha.0",
"version": "6.0.5",
"description": "ANSI to React Elements",

@@ -8,3 +8,6 @@ "main": "lib/index.js",

"nteractDesktop": "src/index.ts",
"scripts": {},
"scripts": {
"build": "tsc -b",
"test": "jest"
},
"repository": "https://github.com/nteract/nteract/tree/master/packages/ansi-to-react",

@@ -28,3 +31,14 @@ "keywords": [

},
"gitHead": "fb8320e26a94889a7b99ede5fd989997d340e9e7"
"devDependencies": {
"@types/enzyme": "^3.10.5",
"@types/jest": "^25.1.4",
"@types/react": "^16.9.23",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.2",
"jest": "^25.1.0",
"react": "^16.13.0",
"react-dom": "^16.13.0",
"ts-jest": "^25.2.1",
"typescript": "^3.8.3"
}
}

@@ -16,3 +16,5 @@ # ansi-to-react

## Usage
### Basic
The example below shows how we can use this package to render a string with ANSI escape codes.

@@ -29,6 +31,8 @@

```
Will render
```javascript
<code>
<span style="color:rgb(0, 0, 187)">hello world</span>
<span style="color:rgb(0, 0, 187)">hello world</span>
</code>

@@ -38,12 +42,14 @@ ```

### Classes
Style with classes instead of `style` attribute.
```javascript
<Ansi useClasses>
{'\u001b[34mhello world'}
</Ansi>;
<Ansi useClasses>{"\u001b[34mhello world"}</Ansi>
```
Will render
```javascript
<code>
<span class="ansi-blue-fg">hello world</span>
<span class="ansi-blue-fg">hello world</span>
</code>

@@ -53,21 +59,22 @@ ```

#### 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|
| 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 |
## Documentation

@@ -79,3 +86,3 @@

If you experience an issue while using this package or have a feature request, please file an issue on the [issue board](https://github.com/nteract/nteract/issues/new/choose) and add the `pkg:ansi-to-react` label.
If you experience an issue while using this package or have a feature request, please file an issue on the [issue board](https://github.com/nteract/ansi-to-react/issues),

@@ -82,0 +89,0 @@ ## License

{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"strict": true,
"declaration": true,
"esModuleInterop": true,
"composite": true,
"lib": ["esnext", "dom"],
"target": "es2017",
"module": "commonjs",
"moduleResolution": "node",
"skipLibCheck": true,
"noImplicitAny": true,
"outDir": "lib",
"rootDir": "src"
"rootDir": "src",
"resolveJsonModule": true,
"preserveWatchOutput": true,
"jsx": "react"
},
"include": ["src"]
"include": ["src"],
"references": []
}
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc