有什么方法可以在 Mac 上从命令行漂亮地打印 HTML 或 XML 字符串吗?尝试在 Ruby 中执行此操作。有任何想法吗?我考虑过 XSLT,并考虑过编写我自己的解析器,但这两者都非常复杂。正在寻找已经存在的东西。
最佳答案
XML 文件
xmllint --format file.xml
HTML 文件
xmllint --format --html file.html
http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man1/xmllint.1.html
关于html - 在 Ruby(或 Shell)中漂亮地打印 HTML,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3375709/