命令行HTML漂亮打印机:使杂乱的HTML可读 [英] A command-line HTML pretty-printer: Making messy HTML readable

查看:90
本文介绍了命令行HTML漂亮打印机:使杂乱的HTML可读的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找满足以下要求的HTML漂亮打印机的建议:


  • 将HTML作为输入,然后输出
  • 必须支持命令行操作。

  • 必须是开放式格式/正确缩进但给定输入HTML的图形等效版本。
  • 源代码和在Linux下运行。 更新2015年 a href =http://www.html-tidy.org/ =noreferrer> Tidy-html5 也应该考虑,因为它支持包括HTML5在内的现代标准。这里是它的 GitHub仓库


    HTML工具的granddaddy,支持现代标准。
    $ b

    Tidy是Mac OS X,Linux,Windows,UNIX,和更多。它通过修正标记错误并将旧代码升级到现代标准来纠正和清理HTML和XML文档。






    原始回复:



    查看HTML Tidy项目: http://tidy.sourceforge.net/ b
    $ b


    阅读HTML ,XHTML和XML文件并写入清理标记。对于HTML变体,它可以检测并纠正许多常见的编码错误,并努力制作符合W3C标准并在大多数浏览器上都可以使用的视觉等效标记。

    为了您的需要,这里是命令行来调用Tidy:

      tidy -im inputfile.html 


    I'm looking for recommendations for HTML pretty printers which fulfill the following requirements:

    • Takes HTML as input, and then output a nicely formatted/correctly indented but "graphically equivalent" version of the given input HTML.
    • Must support command-line operation.
    • Must be open-source and run under Linux.

    解决方案

    Update 2015: Tidy-html5 should also be considered as it supports modern standards including HTML5. Here is its GitHub repository.

    The granddaddy of HTML tools, with support for modern standards.

    Tidy is a console application for Mac OS X, Linux, Windows, UNIX, and more. It corrects and cleans up HTML and XML documents by fixing markup errors and upgrading legacy code to modern standards.


    Original reply:

    Have a look at the HTML Tidy Project: http://tidy.sourceforge.net/

    Tidy reads HTML, XHTML and XML files and writes cleaned up markup. For HTML variants, it detects and corrects many common coding errors and strives to produce visually equivalent markup that is both W3C compliant and works on most browsers.

    For your needs, here is the command line to call Tidy:

    tidy -im inputfile.html
    

    这篇关于命令行HTML漂亮打印机:使杂乱的HTML可读的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆