I have a list like
- 3
- 2
- 1
I'd like to sort it before displaying. How do I do that?
I've tried variations of #show list
,
#let a = [
- 3
- 2
- 1
]
#a.children.sorted()
I can't quite work how how to hook in to what I want here.
I have a list like
- 3
- 2
- 1
I'd like to sort it before displaying. How do I do that?
I've tried variations of #show list
,
#let a = [
- 3
- 2
- 1
]
#a.children.sorted()
I can't quite work how how to hook in to what I want here.
There's two ways you can do this. First, you probably want to save your list data in an array independently of the list type. Then you can sort it and spread the sorted list with the
..
-operator into#list
.If your data consists of integers, you will have to convert it to
content
first currently. The second approach is using afor
-loop, no spreading or mapping required.