From time to time, I encounter posts that use nested lists, where one of the lists uses numbers (1., 2., 3.) as markers and the other uses letters (a), b), c)), but are not properly formatted (example).

I think using different markers makes the post less confusing, but I didn't figure out a way to format it properly, without changing all the markers to numbers.

I tried to use HTML <ol> with type attribute, but it produces really weird results:

<ol type="a">
<li> first item </li>
<li> second item </li>
  • first item
  • second item

  • Desired result:

    Is there some way to achieve this using current implementation of Markdown? If not, could some way to create lists with letter markers be added (whether by extending Markdown or by parsing HTML properly)?

    • @AzizShaikh Yeah, but that doesn't mention letter markers anywhere.
      – svick
      Nov 20 '12 at 8:04
    • Instead of hacking markdown to somehow support it it would probably be a better idea to allow the <ol> html tag. Nov 20 '12 at 8:09
    • Here is a fiddle showing the desired result. @Thief the <ol> is allowed, or at least parsed, but its type attribute being stripped or ignored. Nov 20 '12 at 8:11
    • Stack Exchange is using HTML5 (if I remember correctly) and type attribute has been deprecated in HTML5. Maybe that is the reason it is not working as you have expected. Nov 20 '12 at 8:12
    • @ShaWizDowArd: At least in the JS preview it is stripped. What you probably see are just plain <li> without being enclosed in a list. Nov 20 '12 at 8:12
    • 2
      @Aziz on the contrary: it was deprecated in HTML 4 and supported again in HTML5. That said, looks like Firefox as a browser does not support it. EDIT: well, running this fiddle in Firefox works just fine so I'd say it works on all browsers. Nov 20 '12 at 8:23
    • @ShaWizDowArd: The Markdown-to-HTML rendering has stripped the <ol> tag altogether. It's not there in the resulting HTML source. Nov 20 '12 at 10:08
    • @MartijnPieters but it did something, as there is a list. (unordered though) Nov 20 '12 at 10:19
    • @ShaWizDowArd: Yes, only the <li> elements are there, not the parent <ol> container element. Nov 20 '12 at 10:20
    • @MartijnPieters oh my, orphan <li>! Well then, as it cause the whole HTML of the page to become invalid I'd classify this as a bug, the code should either allow <ol> or strip its children as well. Nov 20 '12 at 10:27
    • @ShaWizDowArd: If you do, file it with the markdown library used for the SE sites. :-) Nov 20 '12 at 10:30
    • This would be very useful. :P
      – Alenanno
      Mar 7 '13 at 10:25

    I wouldn't mind seeing lettered lists as well. I came here to post the same thing, prompted by my edit (edit #3) here: https://stackoverflow.com/posts/5760019/revisions

    The OP attempted to use lettered lists, but the formatting was incorrect. I corrected the list formatting but had to change to numbered lists since there was no support for lettered lists.

    Of course, this is fairly minor -- in this case (and in the majority of cases, I believe) the list can still be represented in a semantically correct way by using numbers or bullets instead of letters, so it's no big deal. It would be a nice option to have, though.

    • Imagine a block of text that starts with a name, with the first initial: J. Skeet is a StackOverflow power user. This would get turned into a list. I too, would like a solution that allows for letters to be the markers of ordered lists, but I don't know how we'd distinguish between the above, and an ordered list.
      – crush
      Jan 22 '14 at 21:36
    • Good point. Perhaps some other character besides a dot could be recognized instead? E.g. a lettered list must be "a)" "b)" and so on.
      – Jason C
      Feb 8 '14 at 18:37

    You must log in to answer this question.

    Not the answer you're looking for? Browse other questions tagged .