RE: tidy: request for enhancement: empty lines between block-level elements

[courtesy of Dave Raggett's forward to the html-tidy list...]

Arnaud Desitter wrote:
>> On Thu, 11 Nov 2004, Amelia A Lewis wrote:
>>> Rather than listing tags which would deserve this treatment, I'd
>>> suggest that all block level elements be optionally spaced in this
>>> fashion.  This would likely produce some oddities, but for the
>>> most part, it would help me immensely, in using tidy for cleanup.

> Have you tried "--vertical-space yes" ?

Or "--indent auto"?

Given this input (test.html):

  <h2 class="wotsis">header</h2>
  <p>lorem ipsum dolor est.</p>
  <p>and then some.</p>

and this config file[1] (tidy.cfg):

  doctype: strict
  output-xhtml: yes
  add-xml-decl: no
  indent: auto
  wrap: 76
  char-encoding: ascii
  ascii-chars: no
  clean: no
  drop-font-tags: yes
  logical-emphasis: yes
  drop-empty-paras: yes
  tidy-mark: no
  alt-text:
  enclose-text: yes
  enclose-block-text: yes
  force-output: yes

with this command line:

  tidy -config tidy.cfg test.html

emits this:

  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

  <html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title></title>
  </head>

  <body>
    <h2 class="wotsis">header</h2>

    <p>lorem ipsum dolor est.</p>

    <p>and then some.</p>
  </body>
  </html>

If you don't want that indentation (as above), use Arnaud's suggestion of
the "vertical-space" option.  I.e., replace "indent: auto" with
"vertical-space: yes" in your config file.

Also it's *generally* advisable to be using a recent version of Tidy from
http://tidy.sourceforge.net.


/Jelks


[1]: See http://tidy.sourceforge.net/docs/quickref.html  (Note the sample
config file I gave above has many superfluous options to what was needed for
your case: it was just a quick paste of one I use.)

Received on Friday, 12 November 2004 16:33:48 UTC