Comments (5)
After stripping all the ansii using that regex mentioned here This is how it looks like: To me its looking very much usable.
![render_test_ts_snap_—_console-table-printer](https://private-user-images.githubusercontent.com/19285393/250350466-4d3fb4da-5c2f-4769-8cd7-53d3ccfa0778.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTg5MTg0NzQsIm5iZiI6MTcxODkxODE3NCwicGF0aCI6Ii8xOTI4NTM5My8yNTAzNTA0NjYtNGQzZmI0ZGEtNWMyZi00NzY5LThjZDctNTNkM2NjZmEwNzc4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjIwVDIxMTYxNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTY1Njg1ZWNhNGJjMDhlOGFjZTA1NjJlYTY3N2UzY2Y5ZTdiZTU1YmJiMTkwMWNkZGRlOTk5ZTk2YmNmMjJjY2ImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.pI3xW6yyb3PB_hZcBd1bXg5cukjjWcoyKVM2aCdavXc)
// Find the latest regex from [the code](https://github.com/ayonious/console-table-printer/blob/master/src/utils/console-utils.ts#L5)
const colorRegex = /\x1b\[\d{1,3}(;\d{1,3})*m/g; // \x1b[30m \x1b[305m \x1b[38;5m
export const stripAnsi = (str: string): string => str.replace(colorRegex, '');
// Create table and add rows.....
// render, strip and print
const rendered = stripAnsi(p.render());
console.log(rendered);
from console-table-printer.
Interesting idea!
Lets create a function called renderRaw and get output from that.
Feel free to open a PR
from console-table-printer.
Been trying every RegEx I can think of / find and still can't get the control characters stripped from the output such that it renders as raw text. Bummer.
from console-table-printer.
This could be a good regex to use to strip all special chars. Needs some testing though
https://github.com/ayonious/console-table-printer/blob/master/src/utils/console-utils.ts#L5
from console-table-printer.
This has been included in this feature:
https://console-table.netlify.app/docs/doc-no-ascii
If its not yet resolved feel free to open again
from console-table-printer.
Related Issues (20)
- Error: Invalid count value when no rows HOT 5
- Horizontal and vertical lines are colored differently HOT 13
- unicode breaks alignment HOT 3
- Emoji charLength when combining with text HOT 2
- Text wrap as option
- newlines in cells produce newlines in table HOT 2
- Order of columns? HOT 3
- [feature] reset, empty rows HOT 6
- [feature] new colors (orange) HOT 2
- Crimson color doesn't apply to the table HOT 2
- Feature Request: Easy method for disabling color output HOT 11
- Suggestion: More header options, data options HOT 1
- Documentation request: Is the index property required? HOT 4
- Suggestion: add a divider option so can separate different rows HOT 1
- Documentation and/or Feature Request: Make it easier to learn how to create a "Row Number" column
- Bug: `table.addColumn` and `table.addColumns` have incorrect type signatures.
- Feature Request: narrow `any` types in typescript files HOT 1
- Doc to be updated
- Alignment has no effect (v2.12.0) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from console-table-printer.