Notwithstanding Precautions, Misadventure

    ansi-color-parse

    0.1.5 • Public • Published

    ansi-color-parse

    Usage

    npm install ansi-color-parse
    
    
    const {parseAnsi, ansi2html, parseHtml} = require('ansi-color-parse');
    
    const str = "\u001b[34mHello\u001b[39m World\u001b[31m!\u001b[39m";
    
    const parseList = parseAnsi(str);
    
    console.log(parseList);
    // [ { foreground: 'blue', text: 'Hello' },
    //   { text: ' World' },
    //   { foreground: 'red', text: '!' } ]
    
    console.log(ansi2html(parseList));
    // <span class="blue">Hello</span><span> World</span><span class="red">!</span>
    
    console.log(parseHtml(str));
    //<span class="blue">Hello</span><span> World</span><span class="red">!</span>

    License

    MIT

    Copyright (c) 2018 蓝色的秋风

    Keywords

    none

    Install

    npm i ansi-color-parse

    DownloadsWeekly Downloads

    23

    Version

    0.1.5

    License

    MIT

    Unpacked Size

    16.3 kB

    Total Files

    12

    Last publish

    Collaborators

    • hua1995116