list
元素元素元素函数可用set
和show
规则自定义样式。
set
和show
规则自定义样式。A bullet list.
Displays a sequence of items vertically, with each item introduced by a marker.
Example
Normal list.
- Text
- Math
- Layout
- ...
Multiple lines.
- This list item spans multiple
lines because it is indented.
Function call.
#list(
[Foundations],
[Calculate],
[Construct],
[Data Loading],
)

Syntax
This functions also has dedicated syntax: Start a line with a hyphen, followed by a space to create a list item. A list item can contain multiple paragraphs and other block-level content. All content that is indented more than an item's marker becomes part of that item.
参数参数参数是传给函数的输入,写在函数名后的括号中。
tight
可用set规则可用set规则可用set
规则设置参数,更改后续调用时的默认值。
set
规则设置参数,更改后续调用时的默认值。If this is false
, the items are spaced apart with
list spacing. If it is true
, they use normal
leading instead. This makes the list more compact, which
can look better if the items are short.
In markup mode, the value of this parameter is determined based on
whether items are separated with a blank line. If items directly follow
each other, this is set to true
; if items are separated by a blank
line, this is set to false
.
默认值: true
展开例子
- If a list has a lot of text, and
maybe other inline content, it
should not be tight anymore.
- To make a list wide, simply insert
a blank line between the items.

marker
The marker which introduces each item.
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
control, you may pass a function that maps the list's nesting depth
(starting from 0
) to a desired marker.
默认值: [•]
展开例子
#set list(marker: [--])
- A more classic list
- With en-dashes
#set list(marker: ([•], [--]))
- Top-level
- Nested
- Items
- Items

body-indent
可用set规则可用set规则可用set
规则设置参数,更改后续调用时的默认值。
set
规则设置参数,更改后续调用时的默认值。The spacing between the marker and the body of each item.
默认值: 0.5em
spacing
The spacing between the items of a wide (non-tight) list.
If set to auto
, uses the spacing below blocks.
默认值: auto
children
The bullet list's children.
When using the list syntax, adjacent items are automatically collected into lists, even through constructs like for loops.
展开例子
#for letter in "ABC" [
- Letter #letter
]
