diff options
Diffstat (limited to 'docs/src/reference/styling.md')
| -rw-r--r-- | docs/src/reference/styling.md | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/docs/src/reference/styling.md b/docs/src/reference/styling.md index a3cc3c2e..d088d61d 100644 --- a/docs/src/reference/styling.md +++ b/docs/src/reference/styling.md @@ -12,11 +12,12 @@ of elements. ## Set rules { #set-rules } With set rules, you can customize the appearance of elements. They are written -as a [function call]($type/function) to the respective function preceded by the -`{set}` keyword (or `[#set]` in markup). Only optional parameters of that -function can be provided to the set rule. Refer to each function's documentation -to see which parameters are optional. In the example below, we use two set rules -to change the [font family]($func/text.family) and +as a [function call]($type/function) to an +[element function]($type/function/#element-functions) preceded by the `{set}` +keyword (or `[#set]` in markup). Only optional parameters of that function can +be provided to the set rule. Refer to each function's documentation to see which +parameters are optional. In the example below, we use two set rules to change +the [font family]($func/text.family) and [heading numbering]($func/heading.numbering). ```example @@ -62,9 +63,10 @@ a _set-if_ rule. ## Show rules { #show-rules } With show rules, you can deeply customize the look of a type of element. The most basic form of show rule is a _show-set rule._ Such a rule is written as the -`{show}` keyword followed by a function name, a colon and then a set rule. This -lets the set rule only apply to the selected element. In the example below, -headings become dark blue while all other text stays black. +`{show}` keyword followed by a [selector]($type/selector), a colon and then a set rule. The most basic form of selector is an +[element function]($type/function/#element-functions). This lets the set rule +only apply to the selected element. In the example below, headings become dark +blue while all other text stays black. ```example #show heading: set text(navy) @@ -78,7 +80,7 @@ achieve many different effects. But they still limit you to what is predefined in Typst. For maximum flexibility, you can instead write a show rule that defines how to format an element from scratch. To write such a show rule, replace the set rule behind the colon with an arbitrary -[function]($type/function). This functions receives the element in question and +[function]($type/function). This function receives the element in question and can return arbitrary content. Different [fields]($scripting/#fields) are available on the element passed to the function. Below, we define a show rule that formats headings for a |
