[ Intro | Download | Docs | How to install/upgrade | Bugs | Notes for qvwm users | Contributing | Mirrors ]


tpad & HTML Tidy

Important: please note that there is a bug in this plugin that affects the current release of tpad (1.3). You can find a patch here.

Plugin usage

HTML TIDY is a validator, corrector and pretty-printer for HTML files developed by Dave Ragget of W3C.

tpad has a plugin that makes very easy to invoke Tidy without exiting the editor or remembering the command line options. Here is a screenshot:

tpad tidy plugin

There are two modes of operation: "Validate" and "Validate and correct".

"Validate" will never modify the original version. It will simply show any warning/error Tidy found in your document in the listbox titled "Last Error Messages and Advice". Clicking on an element of this list will position the cursor to the row and column where the problem occurred. Note that if you insert or delete lines from the text, you will have to repeat the validation before going on fixing the next error, in order to re-align the error log with the newly modified text.

"Validate and correct" will output the same error log as "Validate", but it will then update the original text with the tidied up version. It will do this as a whole operation you can undo/redo. In this case, the error log can't be used to position the cursor to the point where an error occurred and clicking on an element of the error list will do nothing.

Always use the "Validate" mode if you want to preserve the original layout. The drawback is that you will have to fix any warning or error by yourself. Also none of the option applies to this mode, with the exception of -xml and some more advanced options you may define in an external configuration file. This is because no pretty-printed version is generated as this mode uses the -e command line option.

Use the "Validate and correct" mode if you want Tidy to do all the clean up work for you. All the options apply to this mode. The drawback is that you will lose the original layout. But this is not as bad as may seem, because it is easier to let Tidy take care of applying a consistent indentation and wrapping than doing it yourself. Note that if the document has errors that Tidy doesn't know how to fix (e.g. unknown tags and unterminated attribute values), it won't generate a pretty printed version. In those cases, "Validate and correct" will just behave as "Validate".


Since Tidy is not a tpad dependency, the tidy plugin isn't enabled by default. Please follow this simple procedure to enable it:

  1. first install Tidy and Tcllib (which is also required by this plugin)
  2. edit the general config file tpad.conf, locating a line like this:
    variable tidy {}  ;# tidy(1) path (empty if you don't have it)
    Here insert the path to the tidy executable. Assuming tpad(1) is in your default search path, it will suffice to just insert the name of the command:
    variable tidy {tidy}  ;# tidy(1) path (empty if you don't have it)
  3. follow the same step 2 for each per-user config file ~/.tpadrc, if he/she is interested in using tidy with tpad


[ Return to Contents ] Logo Valid HTML 4.01! Petition for a Software Patent Free Europe

Last modified: Sunday, 21-Dec-2014 23:37:54 UTC