Table of Contents

Name

hindent - HTML reformatting/nesting utility

Synopsis

hindent [-fslcv] [-i num] [-t num] [file ...]

Description

This utility takes one or more HTML files and reformats them by properly indenting them for greater human readability. The new HTML code is written to standard output, any errors go to standard error. If no file is specified, hindent reads from standard input. If more than one file is specified, each is taken in turn and all output is concatenated (with no way to distinguish when one output ends and the next begins).

Without any options, hindent simply varies the amount of whitespace at the beginning of each line of input - no lines are added or subtracted from the HTML code. This means that it generates output that should draw the same on all browsers as the input HTML. If the -s or -f options are used, the resulting HTML may not draw exactly the same any more. It is important that you keep your original HTML data around, just in case!

This version of hindent understands all container tags defined in the HTML 3.2 standard.

Options

-c
Case. Forces all tags to lowercase. By default, hindent forces all tags to uppercase.
-f
Flow. Prints just tags without any data between the tags. Damages the HTML in a big way, so save a copy of your original HTML. This option helps you follow the HTML code flow visually.
-i num
Indent level. Set indentation to this many character spaces per code nesting level. If set to 0, no indentation is done (all output is left-justified).
-l
List tags. Causes hindent to print a complete list of tags that it recognizes to stdout, and exits.
-s
Strict. Multiple tags per line are broken out onto separate lines. Can damage the HTML in minor ways by drawing an extra space character in certain parts of the web page, so save a copy of your original HTML. This option helps you follow the HTML code flow visually, especially with computer-generated HTML that comes out all on one line.
-t num
Tab stop. Set the number of spaces that a tab character occupies on your system. Defaults to 8, but some people prefer expanding tabs to 4 spaces instead. If set to 0, no tabs are output (spaces used to indent lines).
-v
Version. Prints hindent’s version number to stdout and exits immediately.

The -s option is the most useful, it would be the default if it didn’t damage the HTML code.

Any combination of these options may be used.

Examples

Example 1. Download a web page, reformat it, view it:

CRlynx -source http://www.domtools.com/~pab | hindent | moreExample 2. View only the structure, one tag per line:

CRlynx -source http://www.domtools.com/~pab | hindent -s -f | moreExample 3. Reformat my home page non-damagingly with 4-space tabs, keeping a backup copy:



CRcd $HOME/public_htmlmv index.html index.html.oldhindent -i4 index.html.old > index.htmlSite

The master web page for this tool is:
http://www.domtools.com/unix/hindent.shtml

Version

Hindent version 1.1.2

Author

Paul Balyoz <pab@domtools.com>


Table of Contents