sensiolabs / ansi-to-html

An ANSI to HTML5 converter
MIT License
237 stars 31 forks source link

Alternative css class naming doesn't work due to hardcoded values #12

Open tommey opened 7 years ago

tommey commented 7 years ago

I tried to shorten the output by defining the css prefix as 'ac', but realized that it will never work due to the fact that the converter has ansicolor hardcoded and there is no connection between the Theme and the Converter.

$converter = new AnsiToHtmlConverter();
$converter->convert('some random cli output'); // returns classes with "ansi_color" prefix
$converter->getTheme()->asCss('css_prefix_for_ansi_color'); // returns styles with given prefix
rquadling commented 7 years ago

By the time the content has been converted, extracting the CSS with the new prefix is impossible.

If the prefix was supplied during construction of AnsiToHtmlConverter, that would then be possible.

I've created https://github.com/sensiolabs/ansi-to-html/pull/16