diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-05-19 11:04:20 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-05-19 11:04:20 +0200 |
| commit | 56a96881a54dd3784e0db22e36130eddf4e19a02 (patch) | |
| tree | 4a1a78c35663a81a77406e5b21f0b8d423e98130 /docs/src/reference/syntax.md | |
| parent | 551ea99d05166b0be50792f767ddd38b996e32fa (diff) | |
Doc links for function scopes
Diffstat (limited to 'docs/src/reference/syntax.md')
| -rw-r--r-- | docs/src/reference/syntax.md | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/docs/src/reference/syntax.md b/docs/src/reference/syntax.md index 014c5640..d0cd80d7 100644 --- a/docs/src/reference/syntax.md +++ b/docs/src/reference/syntax.md @@ -30,7 +30,7 @@ more about their syntax and usage. | Bullet list | `[- item]` | [`list`]($func/list) | | Numbered list | `[+ item]` | [`enum`]($func/enum) | | Term list | `[/ Term: description]` | [`terms`]($func/terms) | -| Math | `[$x^2$]` | [Math]($category/math) | +| Math | `[$x^2$]` | [Math]($category/math) | | Line break | `[\]` | [`linebreak`]($func/linebreak) | | Smart quote | `['single' or "double"]` | [`smartquote`]($func/smartquote) | | Symbol shorthand | `[~, ---]` | [Symbols]($category/symbols/sym) | @@ -52,7 +52,7 @@ follows: | Block-level math | `[$ x^2 $]` | [Math]($category/math) | | Bottom attachment | `[$x_1$]` | [`attach`]($category/math/attach) | | Top attachment | `[$x^2$]` | [`attach`]($category/math/attach) | -| Fraction | `[$1 + (a+b)/5$]` | [`frac`]($func/frac) | +| Fraction | `[$1 + (a+b)/5$]` | [`frac`]($func/math.frac) | | Line break | `[$x \ y$]` | [`linebreak`]($func/linebreak) | | Alignment point | `[$x &= 2 \ &= 3$]` | [Math]($category/math) | | Variable access | `[$#x$, $pi$]` | [Math]($category/math) | @@ -70,38 +70,38 @@ Within code blocks and expressions, new expressions can start without a leading `#` character. Many syntactic elements are specific to expressions. Below is a table listing all syntax that is available in code mode: -| Name | Example | See | -| ------------------------ | ----------------------------- | ---------------------------------------------------- | -| Variable access | `{x}` | [Scripting]($scripting/#blocks) | -| Any literal | `{1pt, "hey"}` | [Types]($types) | -| Code block | `{{ let x = 1; x + 2 }}` | [Scripting]($scripting/#blocks) | -| Content block | `{[*Hello*]}` | [Scripting]($scripting/#blocks) | -| Parenthesized expression | `{(1 + 2)}` | [Scripting]($scripting/#blocks) | -| Array | `{(1, 2, 3)}` | [Array]($type/array) | -| Dictionary | `{(a: "hi", b: 2)}` | [Dictionary]($type/dictionary) | -| Unary operator | `{-x}` | [Scripting]($scripting/#operators) | -| Binary operator | `{x + y}` | [Scripting]($scripting/#operators) | -| Assignment | `{x = 1}` | [Scripting]($scripting/#operators) | -| Field access | `{x.y}` | [Scripting]($scripting/#fields) | -| Method call | `{x.flatten()}` | [Scripting]($scripting/#methods) | -| Function call | `{min(x, y)}` | [Function]($type/function) | -| Unnamed function | `{(x, y) => x + y}` | [Function]($type/function) | -| Let binding | `{let x = 1}` | [Scripting]($scripting/#bindings) | -| Named function | `{let f(x) = 2 * x}` | [Function]($type/function) | -| Set rule | `{set text(14pt)}` | [Styling]($styling/#set-rules) | -| Set-if rule | `{set text(..) if .. }` | [Styling]($styling/#set-rules) | -| Show-set rule | `{show par: set block(..)}` | [Styling]($styling/#show-rules) | -| Show rule with function | `{show raw: it => {..}}` | [Styling]($styling/#show-rules) | -| Show-everything rule | `{show: columns.with(2)}` | [Styling]($styling/#show-rules) | +| Name | Example | See | +| ------------------------ | ----------------------------- | ---------------------------------- | +| Variable access | `{x}` | [Scripting]($scripting/#blocks) | +| Any literal | `{1pt, "hey"}` | [Types]($types) | +| Code block | `{{ let x = 1; x + 2 }}` | [Scripting]($scripting/#blocks) | +| Content block | `{[*Hello*]}` | [Scripting]($scripting/#blocks) | +| Parenthesized expression | `{(1 + 2)}` | [Scripting]($scripting/#blocks) | +| Array | `{(1, 2, 3)}` | [Array]($type/array) | +| Dictionary | `{(a: "hi", b: 2)}` | [Dictionary]($type/dictionary) | +| Unary operator | `{-x}` | [Scripting]($scripting/#operators) | +| Binary operator | `{x + y}` | [Scripting]($scripting/#operators) | +| Assignment | `{x = 1}` | [Scripting]($scripting/#operators) | +| Field access | `{x.y}` | [Scripting]($scripting/#fields) | +| Method call | `{x.flatten()}` | [Scripting]($scripting/#methods) | +| Function call | `{min(x, y)}` | [Function]($type/function) | +| Unnamed function | `{(x, y) => x + y}` | [Function]($type/function) | +| Let binding | `{let x = 1}` | [Scripting]($scripting/#bindings) | +| Named function | `{let f(x) = 2 * x}` | [Function]($type/function) | +| Set rule | `{set text(14pt)}` | [Styling]($styling/#set-rules) | +| Set-if rule | `{set text(..) if .. }` | [Styling]($styling/#set-rules) | +| Show-set rule | `{show par: set block(..)}` | [Styling]($styling/#show-rules) | +| Show rule with function | `{show raw: it => {..}}` | [Styling]($styling/#show-rules) | +| Show-everything rule | `{show: columns.with(2)}` | [Styling]($styling/#show-rules) | | Conditional | `{if x == 1 {..} else {..}}` | [Scripting]($scripting/#conditionals) | -| For loop | `{for x in (1, 2, 3) {..}}` | [Scripting]($scripting/#loops) | -| While loop | `{while x < 10 {..}}` | [Scripting]($scripting/#loops) | -| Loop control flow | `{break, continue}` | [Scripting]($scripting/#loops) | -| Return from function | `{return x}` | [Function]($type/function) | -| Include module | `{include "bar.typ"}` | [Scripting]($scripting/#modules) | -| Import module | `{import "bar.typ"}` | [Scripting]($scripting/#modules) | -| Import items from module | `{import "bar.typ": a, b, c}` | [Scripting]($scripting/#modules) | -| Comment | `[/* block */, // line]` | [Below](#comments) | +| For loop | `{for x in (1, 2, 3) {..}}` | [Scripting]($scripting/#loops) | +| While loop | `{while x < 10 {..}}` | [Scripting]($scripting/#loops) | +| Loop control flow | `{break, continue}` | [Scripting]($scripting/#loops) | +| Return from function | `{return x}` | [Function]($type/function) | +| Include module | `{include "bar.typ"}` | [Scripting]($scripting/#modules) | +| Import module | `{import "bar.typ"}` | [Scripting]($scripting/#modules) | +| Import items from module | `{import "bar.typ": a, b, c}` | [Scripting]($scripting/#modules) | +| Comment | `[/* block */, // line]` | [Below](#comments) | ## Comments { #comments } Comments are ignored by Typst and will not be included in the output. This |
