[Pmwiki-users] rendering question about lists (somewhat important)

Patrick R. Michaud pmichaud
Mon Feb 2 22:45:12 CST 2004


On Mon, Feb 02, 2004 at 10:30:38PM -0500, Reimer Behrends wrote:
> > 
> > All I'm doing is adding the following rule to the pmwiki.css
> > stylesheet:
> > 
> > dl, ul, ol, pre { margin-top:0; margin-bottom:0; }
> > 
> > This may not be universally supported by all browsers, but then
> > it wouldn't make a big difference on those browsers anyway.
> 
> This should have a net zero effect on the layout (except that lists
> following one another will effectively be merged), because the margins
> of the paragraph before and after will still result in vertical
> whitespace being inserted (a quick local test confirms that). 

Ummm...*what paragraphs*?  In the markup:

   This is some text
   * bullet 1
   This is some more text

there aren't any paragraphs, there's just:

   This is some text
   <ul><li>bullet 1</li></ul>
   This is some more text

and it works just fine, at least under IE6 and NS 7.1.  
I've set up a comparison demonstration on pmichaud.com:
   http://www.pmichaud.com/wiki/Development/ListSpacing0    - w/o the css rule
   http://www.pmichaud.com/wiki/Development/ListSpacing1    - w/ the css rule

> The problem with that -- as I understand your proposal -- is that the
> layout will vary depending on whether authors insert a blank line
> before/after a list. This does not create a consistent layout, because
> sometimes they will do one thing and sometimes they will do another
> thing. Effectively, layout will be a function of markup rather than
> being independent of markup. Please correct me if I misunderstand
> something.

I think we must be disagreeing about one or both of the following:
1. That text not inside of some sort of list has to be in a paragraph
   container to be valid (X)HTML  (it does not)
2. Whether the behavior I'm describing is a "problem" or a 
   "desirable feature"

Authors typically *want* the output to look like what they entered.  
They want a blank line to appear when they put one in the markup, and 
not appear when they don't have one in the markup.  The browsers' default
behavior for lists means that an author is always forced to have a blank 
line appear around lists whether it's appropriate or not.

The change I propose will provide a "consistent layout" in the sense 
that when there's a blank line in the markup there's blank space in the 
output, and when there's not a blank line in the markup there's not 
a blank space in the output.  This provides the least surprise and
is in fact what most authors would expect.  The fact that some (wiki) 
authors will choose to include a space before/after lists while others 
will not is analogous to the idea that some authors will put vertical
space between list items while others will not.  It depends on the
purpose of the list as to whether vertical space is appropriate.

(Put another way, XHTML is inconsistent in the same way that you
describe--some authors could choose to use <p>...</p> to contain
text, while other authors might choose <div>...</div>.)

I know that this is also the sort of area where people promote the
idea that "content markup should be kept separate from layout".  While
in principle I largely agree with this idea, that's not really PmWiki's
focus.  PmWiki's focus has always been on providing a simpler markup
and system for the collaborative authoring and maintenance of web pages.
In this application, layout *is* something that authors want to have
some control over.

> I think what I'm not getting is why there is a perceived need to
> remove the whitespace in the first place.

This came about because I'm introducing a '-->' markup for indented
text using <div> tags.  The vertical space surrounding lists was
creating very inconsistent results when indented text items were
mixed in with list items because the vertical spaces sometimes appear
and other times do not.  For example,

   normal text here                      normal text here
   * list level 1
   --> text indent level 2                 * list level 1
   *** list level 3                            text indent level 2
   normal text here                                 * list level 3

                                         normal text here

with blank lines before "list level 1" and after "list level 3",
but reversing the markup gives

   normal text here                      normal text here
   -> text indent level 1                   text indent level 1
   ** list level 2                           
   ---> text indent level 3                     * list level 2
   normal text here                                  text indent level 3

                                          normal text here

and replacing the '-->' with ':: :' (<dl>) markups gives

   normal text here                      normal text here
   : : text indent level 1
   ** list level 2                          text indent level 1
   ::: : text indent level 3                    * list level 2
   normal text here                                   text indent level 3

                                         normal text here

While this might seem "consistent" to someone who understands what's
happening behind the scenes in HTML, on the surface (and to a naive
author) it looks very inconsistent because the vertical space seems
to jump from place to place in the output.  To me it's much nicer
and more natural if vertical space appears only where one was 
explicitly placed in the markup.

Pm



More information about the pmwiki-users mailing list