Skip to content
This repository was archived by the owner on Jul 28, 2022. It is now read-only.
This repository was archived by the owner on Jul 28, 2022. It is now read-only.

Output nicely indented HTML? #27

@kindaro

Description

@kindaro

I am enjoying cheapskate very much, and I am very thankful to the authors and maintainers for creating such a great program.

I have a wish though. The usual output from cheapskate has linebreaks between tags, but it is flat, and this makes it hard to inspect visually. One solution is to pipe it through an additional device that does the indenting, such as the tidy command line application that is available quite widely. But I am thinking that maybe the same would not be too hard to bake into cheapskate. It would at least save one parse∘render round trip, and furthermore minimize the possibility of errors and other undesirable side effects.

Source:

Compiler interaction:
---------------------

* Make sure it is straightforward to inspect each invocation of an external program, particularly:
    - Command line.
    - Environment.

  This should save much confuson.

Through cheapskate:

<h2>Compiler interaction:</h2>
<ul>
<li><p>Make sure it is straightforward to inspect each invocation of an external program, particularly:</p>
<ul>
<li>Command line.</li>
<li>Environment.</li>
</ul>
<p>This should save much confuson.</p></li>
</ul>

Through cheapskate | tidy -i -:

line 1 column 1 - Warning: missing <!DOCTYPE> declaration
line 1 column 1 - Warning: inserting implicit <body>
line 1 column 1 - Warning: inserting missing 'title' element
Info: Document content looks like HTML5
Tidy found 3 warnings and 0 errors!

<!DOCTYPE html>
<html>
<head>
  <meta name="generator" content=
  "HTML Tidy for HTML5 for Linux version 5.6.0">
  <title></title>
</head>
<body>
  <h2>Compiler interaction:</h2>
  <ul>
    <li>
      <p>Make sure it is straightforward to inspect each invocation
      of an external program, particularly:</p>
      <ul>
        <li>Command line.</li>
        <li>Environment.</li>
      </ul>
      <p>This should save much confuson.</p>
    </li>
  </ul>
</body>
</html>

About HTML Tidy: https://github.com/htacg/tidy-html5
Bug reports and comments: https://github.com/htacg/tidy-html5/issues
Official mailing list: https://lists.w3.org/Archives/Public/public-htacg/
Latest HTML specification: http://dev.w3.org/html5/spec-author-view/
Validate your HTML documents: http://validator.w3.org/nu/
Lobby your company to join the W3C: http://www.w3.org/Consortium

Do you speak a language other than English, or a different variant of
English? Consider helping us to localize HTML Tidy. For details please see
https://github.com/htacg/tidy-html5/blob/master/README/LOCALIZE.md

In my dream world:

  <h2>Compiler interaction:</h2>
  <ul>
    <li>
      <p>Make sure it is straightforward to inspect each invocation
      of an external program, particularly:</p>
      <ul>
        <li>Command line.</li>
        <li>Environment.</li>
      </ul>
      <p>This should save much confuson.</p>
    </li>
  </ul>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions