diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-09-11 15:53:20 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-09-11 15:53:20 +0200 |
| commit | 3a979e88da7be6240821ba8acfdd376b7f4e0f09 (patch) | |
| tree | b41a095a11d710f0fc5547e5bd0627deafa02af2 /docs/reference/syntax.md | |
| parent | 305524d005df075d53575552ee090fb53192a3fe (diff) | |
Docs generation for types
Diffstat (limited to 'docs/reference/syntax.md')
| -rw-r--r-- | docs/reference/syntax.md | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/docs/reference/syntax.md b/docs/reference/syntax.md index 3209e8e5..c03d6ab3 100644 --- a/docs/reference/syntax.md +++ b/docs/reference/syntax.md @@ -11,7 +11,7 @@ set and show rules, which let you style your document easily and automatically. All this is backed by a tightly integrated scripting language with built-in and user-defined functions. -## Markup { #markup } +## Markup Typst provides built-in markup for the most common document elements. Most of the syntax elements are just shortcuts for a corresponding function. The table below lists all markup that is available and links to the best place to learn @@ -19,20 +19,20 @@ more about their syntax and usage. | Name | Example | See | | ------------------ | ------------------------ | ---------------------------- | -| Paragraph break | Blank line | [`parbreak`]($func/parbreak) | -| Strong emphasis | `[*strong*]` | [`strong`]($func/strong) | -| Emphasis | `[_emphasis_]` | [`emph`]($func/emph) | -| Raw text | ``[`print(1)`]`` | [`raw`]($func/raw) | -| Link | `[https://typst.app/]` | [`link`]($func/link) | -| Label | `[<intro>]` | [`label`]($func/label) | -| Reference | `[@intro]` | [`ref`]($func/ref) | -| Heading | `[= Heading]` | [`heading`]($func/heading) | -| Bullet list | `[- item]` | [`list`]($func/list) | -| Numbered list | `[+ item]` | [`enum`]($func/enum) | -| Term list | `[/ Term: description]` | [`terms`]($func/terms) | +| Paragraph break | Blank line | [`parbreak`]($parbreak) | +| Strong emphasis | `[*strong*]` | [`strong`]($strong) | +| Emphasis | `[_emphasis_]` | [`emph`]($emph) | +| Raw text | ``[`print(1)`]`` | [`raw`]($raw) | +| Link | `[https://typst.app/]` | [`link`]($link) | +| Label | `[<intro>]` | [`label`]($label) | +| Reference | `[@intro]` | [`ref`]($ref) | +| Heading | `[= Heading]` | [`heading`]($heading) | +| Bullet list | `[- item]` | [`list`]($list) | +| Numbered list | `[+ item]` | [`enum`]($enum) | +| Term list | `[/ Term: description]` | [`terms`]($terms) | | Math | `[$x^2$]` | [Math]($category/math) | -| Line break | `[\]` | [`linebreak`]($func/linebreak) | -| Smart quote | `['single' or "double"]` | [`smartquote`]($func/smartquote) | +| Line break | `[\]` | [`linebreak`]($linebreak) | +| Smart quote | `['single' or "double"]` | [`smartquote`]($smartquote) | | Symbol shorthand | `[~, ---]` | [Symbols]($category/symbols/sym) | | Code expression | `[#rect(width: 1cm)]` | [Scripting]($scripting/#expressions) | | Character escape | `[Tweet at us \#ad]` | [Below](#escapes) | @@ -52,8 +52,8 @@ 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/math.frac) | -| Line break | `[$x \ y$]` | [`linebreak`]($func/linebreak) | +| Fraction | `[$1 + (a+b)/5$]` | [`frac`]($math.frac) | +| Line break | `[$x \ y$]` | [`linebreak`]($linebreak) | | Alignment point | `[$x &= 2 \ &= 3$]` | [Math]($category/math) | | Variable access | `[$#x$, $pi$]` | [Math]($category/math) | | Field access | `[$arrow.r.long$]` | [Scripting]($scripting/#fields) | @@ -73,22 +73,22 @@ 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) | +| Any literal | `{1pt, "hey"}` | [Scripting]($scripting/#expressions) | | 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) | +| Array | `{(1, 2, 3)}` | [Array]($array) | +| Dictionary | `{(a: "hi", b: 2)}` | [Dictionary]($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) | -| Argument spreading | `{min(..nums)}` | [Arguments]($type/arguments) | -| Unnamed function | `{(x, y) => x + y}` | [Function]($type/function) | +| Function call | `{min(x, y)}` | [Function]($function) | +| Argument spreading | `{min(..nums)}` | [Arguments]($arguments) | +| Unnamed function | `{(x, y) => x + y}` | [Function]($function) | | Let binding | `{let x = 1}` | [Scripting]($scripting/#bindings) | -| Named function | `{let f(x) = 2 * x}` | [Function]($type/function) | +| Named function | `{let f(x) = 2 * x}` | [Function]($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) | @@ -98,16 +98,16 @@ a table listing all syntax that is available in code mode: | 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) | +| Return from function | `{return x}` | [Function]($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 -is useful to exclude old versions or to add annotations. -To comment out a single line, start it with `//`: +## Comments +Comments are ignored by Typst and will not be included in the output. This is +useful to exclude old versions or to add annotations. To comment out a single +line, start it with `//`: ```example // our data barely supports // this claim @@ -129,9 +129,9 @@ Our study design is as follows: ## Escape sequences { #escapes } Escape sequences are used to insert special characters that are hard to type or otherwise have special meaning in Typst. To escape a character, precede it with -a backslash. To insert any Unicode codepoint, you can write a hexadecimal -escape sequence: `[\u{1f600}]`. The same kind of escape sequences also work in -[strings]($type/string). +a backslash. To insert any Unicode codepoint, you can write a hexadecimal escape +sequence: `[\u{1f600}]`. The same kind of escape sequences also work in +[strings]($str). ```example I got an ice cream for |
