Starting ordered lists at numbers other than 1.
John Gruber
gruber at fedora.net
Sun Mar 28 11:51:33 EST 2004
[I changed the subject here, because the idea of whether Markdown
should allow for some way to started ordered lists at numbers other
than 1 is for the most a different issue than Markdown's list syntax
in general. -J.G.]
Már Örlygsson <mar at anomy.net> wrote on 03/27/04 at 10:25a:
> No, style rules contained in style="" attributes override all other CSS
> rules, no matter what selector syntax they use. See the chapter on
> 'Calculating a selector's specificity' in the CSS2.1 specs:
> http://www.w3.org/TR/2004/CR-CSS21-20040225/cascade.html#specificity
Correct, and so I don't think it'd be a can-of-worms at all if
Markdown were to start adding `style` attributes to set the start
number for ordered lists.
However, the entire idea is moot. I spent an hour or two trying to
determine the syntax for doing this. End up, *it can't be done*.
I'll try to summarize my findings here:
1. The Transitional doctypes for HTML 4.01 and XHTML 1.0 support
the `start` attribute for `<ol>`, and a `value` attribute for
`<li>`. You can use them like this:
<ol start="10">
<li>Ten</li>
<li>Eleven</li>
<li value="20">Twenty</li>
</ol>
which renders like this:
10. Ten
11. Eleven
20. Twenty
2. The W3C deprecated both of these attributes; thus they're
invalid in the Strict doctypes for HTML 4.01 or XHTML 1.0.
A lot of experts consider this deprecation, especially
the `value` attribute, a very bad decision on the part of
the W3C. For example, [Tantek Çelik] [1].
[1]: http://tantek.com/log/2003/01.html#L20030102t0602
The basic idea behind attribute deprecation is that
*presentational* attributes have been deprecated, because
one should use CSS for presentation styling. But the `value`
attribute for list items is not presentational, it specifies
important information about the meaning of the list.
3. The CSS way to accomplish the same things as the old `start`
and `value` tag attributes is to use the CSS properties
`counter-reset` and `counter-increment`.
4. But `counter-reset` and `counter-increment` aren't supported
by any browsers other than Opera. I mean, jesus, it's one thing
if IE doesn't support something, but when neither [Mozilla] [2]
nor [Safari] [3] support it either, it's pretty much unusable.
[2]: http://www.blooberry.com/indexdot/css/supportkey/generate.htm
[3]: http://developer.apple.com/internet/safari/safari_css.html#genrated_content
See also:
<http://archivist.incutio.com/viewlist/css-discuss/23797>
<http://stevarino.com/tests/reverse_ol.htm>
> I wouldn't hold it against Mr Gruber if he chose alternative a) and assumed
> Transitional DTD, but I guess alternative b) would be the least evil of
> those three listed above, ugly style="" styntax clutter be damned.
>
>
> P.S. I strongly think that the W3C made a serious mistake by depricating the
> type="" and start="" attributes on <ol> lists. :-(
I do too.
The long and short of it is, up until yesterday I had assumed that
it was possible to use CSS to accomplish the same things as the
now-deprecated `type` and `start` tag attributes, but it's not.
Markdown is currently intended only to produce (X)HTML Strict
output. I think that's the way it should be -- because it makes
Markdown something web authors can use regardless if their web sites
are using Strict or Transitional doctypes. (Strict code is always
valid in a Transitional document.)
Even though I very much disagree with the W3C's decision regarding
the `type` and `start` tag attributes, that doesn't mean I want to
start generating Transitional output from Markdown.
Thus, for now, I think I'm going to have to scratch the plans for
ordered lists that start with ordinals other than 1.
I still want to add support for lettered-lists:
a. one
b. two
c. three
and Markdown will use CSS in a `style` attribute to achieve this.
* * *
Notably, one of the side effects of this "lists must start at
ordinal 1" rule is that we can get a little bit more specific about
how Markdown parses lists. We could state that ordered lists must
start with one of the following:
* `1.`
* `a.`
* `A.`
This would (a) solve many of the cases where ordered lists can be
triggered by accident; and (b) accurately reflect the rendered
results Markdown will produce.
-J.G.
More information about the Markdown-discuss
mailing list