2017 © Pedro Peláez
 

library ansi-to-html

A library to convert a text with ANSI codes to HTML

image

sensiolabs/ansi-to-html

A library to convert a text with ANSI codes to HTML

  • Tuesday, May 2, 2017
  • by fabpot
  • Repository
  • 14 Watchers
  • 125 Stars
  • 483,732 Installations
  • PHP
  • 29 Dependents
  • 0 Suggesters
  • 20 Forks
  • 7 Open issues
  • 9 Versions
  • 10 % Grown

The README.md

ANSI to HTML5 Converter

This small library only does one thing: converting a text containing ANSI codes to an HTML5 fragment:, (*1)

require_once __DIR__.'/vendor/autoload.php';

use SensioLabs\AnsiConverter\AnsiToHtmlConverter;

$converter = new AnsiToHtmlConverter();

$html = $converter->convert($ansi);

The $ansi variable should contain a text with ANSI codes, and $html will contain the converted HTML5 version of it., (*2)

You can then output the HTML5 fragment in any HTML document:, (*3)

```html+php , (*4)

<pre style="background-color: black; overflow: auto; padding: 10px 15px; font-family: monospace;"

, (*5)


The converter supports different color themes: ```php use SensioLabs\AnsiConverter\Theme\SolarizedTheme; $theme = new SolarizedTheme(); $converter = new AnsiToHtmlConverter($theme);

By default, the colors are inlined into the HTML, but you can also use classes by turning off style inlining:, (*6)

$converter = new AnsiToHtmlConverter($theme, false);

And the asCss() method of the theme object lets you retrieve the theme styles as a CSS snippet:, (*7)

$styles = $theme->asCss();

which you can then use in your HTML document:, (*8)

```html+php , (*9)

The Versions

02/05 2017

dev-master

9999999-dev

A library to convert a text with ANSI codes to HTML

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

02/05 2017

v1.1.3

1.1.3.0

A library to convert a text with ANSI codes to HTML

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

22/07 2015

v1.1.2

1.1.2.0

A library to convert a text with ANSI codes to HTML

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

17/03 2015

v1.1.1

1.1.1.0

A library to convert a text with ANSI codes to HTML

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

01/08 2014

v1.1.0

1.1.0.0

A library to convert a text with ANSI codes to HTML

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

18/10 2013

v1.0.3

1.0.3.0

A library to convert a text with ANSI codes to HTML

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

14/04 2013

v1.0.2

1.0.2.0

A library to convert a text with ANSI codes to HTML

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

19/03 2013

v1.0.1

1.0.1.0

A library to convert a text with ANSI codes to HTML

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

19/03 2013

v1.0.0

1.0.0.0

A library to convert a text with ANSI codes to HTML

  Sources   Download

MIT

The Requires

  • php >=5.3.0