Giter Club home page Giter Club logo

Comments (5)

ayonious avatar ayonious commented on August 24, 2024 1

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

// 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.

ayonious avatar ayonious commented on August 24, 2024

Interesting idea!
Lets create a function called renderRaw and get output from that.
Feel free to open a PR

from console-table-printer.

sheldonth avatar sheldonth commented on August 24, 2024

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.

ayonious avatar ayonious commented on August 24, 2024

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.

ayonious avatar ayonious commented on August 24, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.