diff --git a/docs/blocks/list.nml b/docs/blocks/list.nml new file mode 100644 index 0000000..28f96ad --- /dev/null +++ b/docs/blocks/list.nml @@ -0,0 +1,57 @@ +@import ../template.nml +@nav.previous = Code +%% + +# 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) diff --git a/src/elements/list.rs b/src/elements/list.rs index 3640b50..8390d83 100644 --- a/src/elements/list.rs +++ b/src/elements/list.rs @@ -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| { diff --git a/src/elements/script.rs b/src/elements/script.rs index 0771f43..c1a4367 100644 --- a/src/elements/script.rs +++ b/src/elements/script.rs @@ -310,7 +310,7 @@ impl RegexRule for ScriptRule { } } - // TODO: Process reports + reports.extend(ctx.reports); reports } }