This commit is contained in:
ef3d0c3e 2024-11-02 09:54:58 +01:00
parent 6010024934
commit 61f76c204b
3 changed files with 59 additions and 2 deletions

57
docs/blocks/list.nml Normal file
View file

@ -0,0 +1,57 @@
@import ../template.nml
@nav.previous = Code
%<make_doc({"Blocks"}, "Lists", "Lists")>%
# Lists
* Here is a simple list
** With nested entries
*- Numbered even!
Lists start after a newline with one or more space or tab, followed by `\*` for unnumbered lists or `-` for numbered lists.
**Example**
#+LAYOUT_BEGIN Split
*The following...*
```Markdown
* A
* B
- A
- B
```
#+LAYOUT_NEXT
*...gives the following*
* A
* B
- A
- B
#+LAYOUT_END
# Nested lists
Lists can contain other lists as nested elements.
**Example**
#+LAYOUT_BEGIN Split
*The following...*
```Markdown
- First
--[offset=11] Nested
-- Numbered list!
- Back to the first list
```
#+LAYOUT_NEXT
*...gives the following*
- First
--[offset=11] Nested
-- Numbered list!
- Back to the first list
#+LAYOUT_END
# Properties
Lists currently support these properties:
* ``offset`` (number) The start offset for a numbered list, defaults to 1
* ``bullet`` (currently unused)

View file

@ -199,7 +199,7 @@ impl ListRule {
let mut continue_match = true;
depth.chars().enumerate().for_each(|(idx, c)| {
let number = if offset == usize::MAX {
let number = if offset == usize::MAX || idx + 1 != depth.len() {
prev_entry
.as_ref()
.and_then(|v| {

View file

@ -310,7 +310,7 @@ impl RegexRule for ScriptRule {
}
}
// TODO: Process reports
reports.extend(ctx.reports);
reports
}
}