Add support for custom numbering of ordered list using [@\d+]

org mode supports [1] setting the value attribute [2] of ordered list items to
change the numbering for the current and following items. Let's do the same. As
the attribute has no meaning for other types of lists [2] we'll just not
support it for those cases [3].

[1] https://orgmode.org/manual/Plain-Lists.html#Plain-Lists
[2] https://developer.mozilla.org/en-US/docs/Web/HTML/Element/li#attributes
[3]
Org mode seems to instead set the id attribute for e.g. unordered lists
starting with `[@\d+]\s` - but I don't really see the value in that and will
skip that for now.
This commit is contained in:
Niklas Fasching 2021-04-17 15:39:14 +02:00
parent b3edd6c182
commit 21f1af7d48
6 changed files with 38 additions and 6 deletions

View file

@ -195,3 +195,14 @@ ordered descriptive
<p>unordered 2</p>
</li>
</ul>
<ol>
<li value="2">
<p>use `[@n]` to change the value of list items</p>
</li>
<li class="unchecked">
<p>foobar</p>
</li>
<li value="10" class="checked">
<p>that even works in combination with list statuses (`[ ]`)</p>
</li>
</ol>

View file

@ -68,3 +68,8 @@ some list termination tests
2. ordered descriptive :: 2
- unordered 1
- unordered 2
1. [@2] use `[@n]` to change the value of list items
2. [ ] foobar
3. [@10] [X] that even works in combination with list statuses (`[ ]`)

View file

@ -68,3 +68,8 @@ some list termination tests
2. ordered descriptive :: 2
- unordered 1
- unordered 2
1. [@2] use `[@n]` to change the value of list items
2. [ ] foobar
3. [@10] [X] that even works in combination with list statuses (`[ ]`)