将带有ANSI颜色代码的文本转换为HTML
ansi2html的Python项目详细描述
将带有ANSI颜色代码的文本转换为HTML或LaTex。
从pixelbeat和blackjack的作品中得到启发和发展。
示例-python api
>>> from ansi2html import Ansi2HTMLConverter >>> conv = Ansi2HTMLConverter() >>> ansi = "".join(sys.stdin.readlines()) >>> html = conv.convert(ansi)
示例-Shell用法
$ ls --color=always | ansi2html > directories.html $ sudo tail /var/log/messages | ccze -A | ansi2html > logs.html $ task rc._forcecolor:yes limit:0 burndown | ansi2html > burndown.html
查看完整选项列表:
$ ansi2html --help
许可证
ansi2html已获得lgplv3+许可。