php-markdown icon indicating copy to clipboard operation
php-markdown copied to clipboard

Enhanced Ordered Lists

Open rungta opened this issue 12 years ago • 4 comments

  1. Support multiple types of ordered lists, like upper/lowercase letters and roman numerals in addition to the existing support for decimal markers. So,
a) Alphabet list item 1
b) Item 2

would generate:

<ol type="a">
    <li>Alphabet list item 1</li>
    <li>Item 2</li>
</ol>
  1. Honour the start value of ordered lists, basically delivering on something the original spec had predicted:

At some point in the future, Markdown may support starting ordered lists at an arbitrary number.

So,

3. This list starts at number 3
1. Item
1. Another Item

would generate:

<ol start="3">
    <li>This list starts at number 3</li>
    <li>Item</li>
    <li>Another Item</li>
</ol>

See also: Ordered Lists in Pandoc's Markdown

rungta avatar Apr 19 '13 22:04 rungta

I'm not sure about the type attribute. I'll need some time to think about it and how it can affect parsing (mostly false-positivies). But I'd like to add start eventually.

michelf avatar Apr 25 '13 11:04 michelf

(mostly false-positivies)

Especially cases like:

A. Murray won his first grand slam in 2012.

Pandoc circumvents this thus:

List markers may be enclosed in parentheses or followed by a single right-parentheses or period. They must be separated from the text that follows by at least one space, and, if the list marker is a capital letter with a period, by at least two spaces.

rungta avatar Apr 25 '13 11:04 rungta

Is it possible to combine both the type and the starting value? For example, if I want to have an ol using roman numerals as the type, can I also start the list with the roman numeral iii?

josephavellino avatar Oct 08 '14 11:10 josephavellino

I'm not posting any new issue becuase this is closely related to the previous one.. A support for nested ordered lists (at least one level), e.g.:

1. A list with another nested list
   1.  Subitem 1
   2.  Subitem 2
2. Item
3. Another Item

This would generate a nested list a, b, c:

<ol>
    <li>A list with another nested list</li>
    <ol type="a">
        <li>Subitem 1</li>
        <li>Subitem 2</li>
    </ol>
    <li>Item</li>
    <li>Another Item</li>
</ol>

Currently, this is only possible with unordered nested lists (or vice versa, ordered nested in unordered):

1. A list with another nested list
   *  Subitem 1
   *  Subitem 2
2. Item
3. Another Item

Any new level can be produced by further indenting the nested list and the nested list types can be pre-defined (but by default, HTML supports up to 3 nested ordered list levels without defining the type attribute).

See also: http://meta.stackexchange.com/questions/85474/how-to-write-nested-numbered-lists

mishelka avatar Jun 20 '16 09:06 mishelka