summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/typst/src/model/list.rs13
-rw-r--r--tests/ref/bugs/grid-1.pngbin852 -> 835 bytes
-rw-r--r--tests/ref/compiler/construct.pngbin6230 -> 6113 bytes
-rw-r--r--tests/ref/compiler/show-recursive.pngbin16894 -> 14951 bytes
-rw-r--r--tests/ref/layout/list-marker.pngbin3949 -> 3825 bytes
-rw-r--r--tests/ref/layout/list.pngbin20981 -> 20705 bytes
-rw-r--r--tests/typ/layout/list-marker.typ2
7 files changed, 11 insertions, 4 deletions
diff --git a/crates/typst/src/model/list.rs b/crates/typst/src/model/list.rs
index 623cafa2..afbf9472 100644
--- a/crates/typst/src/model/list.rs
+++ b/crates/typst/src/model/list.rs
@@ -69,7 +69,7 @@ pub struct ListElem {
///
/// Instead of plain content, you can also pass an array with multiple
/// markers that should be used for nested lists. If the list nesting depth
- /// exceeds the number of markers, the last one is repeated. For total
+ /// exceeds the number of markers, the markers are cycled. For total
/// control, you may pass a function that maps the list's nesting depth
/// (starting from `{0}`) to a desired marker.
///
@@ -85,7 +85,14 @@ pub struct ListElem {
/// - Items
/// ```
#[borrowed]
- #[default(ListMarker::Content(vec![TextElem::packed('•')]))]
+ #[default(ListMarker::Content(vec![
+ // These are all available in the default font, vertically centered, and
+ // roughly of the same size (with the last one having slightly lower
+ // weight because it is not filled).
+ TextElem::packed('\u{2022}'), // Bullet
+ TextElem::packed('\u{2023}'), // Triangular Bullet
+ TextElem::packed('\u{2013}'), // En-dash
+ ]))]
pub marker: ListMarker,
/// The indent of each item.
@@ -202,7 +209,7 @@ impl ListMarker {
fn resolve(&self, engine: &mut Engine, depth: usize) -> SourceResult<Content> {
Ok(match self {
Self::Content(list) => {
- list.get(depth).or(list.last()).cloned().unwrap_or_default()
+ list.get(depth % list.len()).cloned().unwrap_or_default()
}
Self::Func(func) => func.call(engine, [depth])?.display(),
})
diff --git a/tests/ref/bugs/grid-1.png b/tests/ref/bugs/grid-1.png
index 5570c165..f60ad7f4 100644
--- a/tests/ref/bugs/grid-1.png
+++ b/tests/ref/bugs/grid-1.png
Binary files differ
diff --git a/tests/ref/compiler/construct.png b/tests/ref/compiler/construct.png
index 6ce83371..f1acf665 100644
--- a/tests/ref/compiler/construct.png
+++ b/tests/ref/compiler/construct.png
Binary files differ
diff --git a/tests/ref/compiler/show-recursive.png b/tests/ref/compiler/show-recursive.png
index 9e502c3f..a5a153c0 100644
--- a/tests/ref/compiler/show-recursive.png
+++ b/tests/ref/compiler/show-recursive.png
Binary files differ
diff --git a/tests/ref/layout/list-marker.png b/tests/ref/layout/list-marker.png
index 5d8523eb..19d6ed5f 100644
--- a/tests/ref/layout/list-marker.png
+++ b/tests/ref/layout/list-marker.png
Binary files differ
diff --git a/tests/ref/layout/list.png b/tests/ref/layout/list.png
index 8a3360b9..269243eb 100644
--- a/tests/ref/layout/list.png
+++ b/tests/ref/layout/list.png
Binary files differ
diff --git a/tests/typ/layout/list-marker.typ b/tests/typ/layout/list-marker.typ
index 6f348530..9e28faad 100644
--- a/tests/typ/layout/list-marker.typ
+++ b/tests/typ/layout/list-marker.typ
@@ -7,7 +7,7 @@
- B
---
-// Test that last item is repeated.
+// Test that items are cycled.
#set list(marker: ([--], [•]))
- A
- B