is there any way to convert bash output to html ? for example if I had some colorized output in bash ( something like htop ), how can I convert it to html tags ... ( something like this: <p style="color: red">some text</p>
)
相关问题
- Views base64 encoded blob in HTML with PHP
- How to get the return code of a shell script in lu
- Is there a way to play audio on a mobile browser w
- HTML form is not sending $_POST values
- implementing html5 drag and drop photos with knock
Yes, you need to pipe the result through a tool like ansi2html.
Without any pretty-printing, the simplest thing you can always do is to escape everything that needs escaping, and wrap a basic HTML shell around (the following should be valid minimal HTML5). For example, get a hold of fastesc: http://raa.ruby-lang.org/project/fastesc/, and that wrap it into an HTML shell.
If you want to preserve the ANSI magic, then you need to convert that to HTML, perhaps with http://ansi-sys.rubyforge.org/
And then do something like this, depending on your needs:
There's
ansifilter
plus some tools likehighlight
will produce colorized html from plain text such as source files.Both available here.