mirror of
https://github.com/typst/typst
synced 2025-05-14 17:15:28 +08:00
Mention fields
function in docs (#3897)
Co-authored-by: Laurenz <laurmaedje@gmail.com>
This commit is contained in:
parent
351cf127f2
commit
33d620ed2e
@ -231,8 +231,11 @@ The body of a loop can be a code or content block:
|
|||||||
- `{while condition [..]}`
|
- `{while condition [..]}`
|
||||||
|
|
||||||
## Fields
|
## Fields
|
||||||
You can use _dot notation_ to access fields on a value. The value in question
|
You can use _dot notation_ to access fields on a value. For values of type
|
||||||
can be either:
|
[`content`], you can also use the [`fields`]($content.fields) function to list
|
||||||
|
the fields.
|
||||||
|
|
||||||
|
The value in question can be either:
|
||||||
- a [dictionary] that has the specified key,
|
- a [dictionary] that has the specified key,
|
||||||
- a [symbol] that has the specified modifier,
|
- a [symbol] that has the specified modifier,
|
||||||
- a [module] containing the specified definition,
|
- a [module] containing the specified definition,
|
||||||
@ -242,13 +245,15 @@ can be either:
|
|||||||
element was constructed.
|
element was constructed.
|
||||||
|
|
||||||
```example
|
```example
|
||||||
|
#let it = [= Heading]
|
||||||
|
#it.body \
|
||||||
|
#it.depth \
|
||||||
|
#it.fields()
|
||||||
|
|
||||||
#let dict = (greet: "Hello")
|
#let dict = (greet: "Hello")
|
||||||
#dict.greet \
|
#dict.greet \
|
||||||
#emoji.face
|
#emoji.face
|
||||||
|
|
||||||
#let it = [= Heading]
|
|
||||||
#it.body \
|
|
||||||
#it.depth
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Methods
|
## Methods
|
||||||
|
Loading…
x
Reference in New Issue
Block a user