jgm / djot

A light markup language
https://djot.net
MIT License
1.67k stars 43 forks source link

Support for smart numbering when making numbered lists #45

Open tbdalgaard opened 2 years ago

tbdalgaard commented 2 years ago

Is it possible to make support for the following syntax when writing lists:


1. This is the first list item.
#. This is the second item.
#. This is the third list item.

This could make numbering lists very nice, when moving list items around when editing a document.

jgm commented 2 years ago

You can already do

1. one
1. another
1. another

Only the first number in the sequence is significant.

tbdalgaard commented 2 years ago

Ok, I am just very used to the way Pandoc can show this, so I thought this syntax looks better, and I like that items can be sequenced like how Pandoc can do this. I understand that DJOT isn't Pandoc at all, I just thought this syntax is easier when reading and composing the document.

jgm commented 2 years ago

I'll consider it.

leroycep commented 2 years ago

Asciidoc also has this feature. It allows you to make ordered lists with just a period, like so:

Ordered list:

. One
. Two
. Three
mtsknn commented 1 year ago

Asciidoc [...] allows you to make ordered lists with just a period

One benefit of using just a period instead of 1. or #.: proper indentation for the list item's body would be 2 spaces (nice) instead of 3 spaces (weird). But this syntax (just a period) would probably work only with the "1." list marker type.

jgm commented 1 year ago

If we do this I prefer #., because . looks too much like a bullet list in the source.

waldyrious commented 1 year ago

Plus there's precedent for # as numbered list markup, e.g. in MediaWiki. Though I do wonder if it could be confusing to have such a similar syntax to that used for headings meaning something completely different when a period is involved.

uvtc commented 1 year ago

I see that 0. works as well.

jgm commented 1 year ago

I agree that there's some danger of visually confusing #. with a heading.

Of course there might be an argument for changing the heading syntax to use = instead of # -- that is also a strong tradition in light markup.

Would the people who want something like this be happy with 0.?

waldyrious commented 1 year ago

Would the people who want something like this be happy with 0.?

I'd rather see = used for headings and reserving # for numbered lists. The practical downside is that the more we deviate from markdown, the harder the adoption of Djot will be, but on the other hand, besides MediaWiki and other lightweight markup languages using = for headings, even markdown supports the symbol associated with headings, particularly in setext-style headings.

tbdalgaard commented 1 year ago

I wouldn't mind making two spaces after the list marker like

. {space {space}

I have never liked the use of = for headings. I think the # in for defining headers is easier to read. Note: I am one of the people who really loves the idea behind DJOT, but aren't smart enough to code anything... I just love to markup text with options like DJOT. :)

stoicon commented 3 months ago

What about using $ for an ordered list?

$ One
$ Two
$ Three

$ is already used in Mathematical and numerical contexts (LaTeX math and currency).