Slightly improve tables in syntax.md (#4151)

This commit is contained in:
Malo 2024-05-16 19:17:10 +02:00 committed by GitHub
parent aad68ea489
commit 2245e02b4e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -34,26 +34,26 @@ 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 below lists all markup that is available and links to the best place to learn
more about their syntax and usage. more about their syntax and usage.
| Name | Example | See | | Name | Example | See |
| ------------------ | ------------------------ | ---------------------------- | | ------------------ | ---------------------------- | ------------------------ |
| Paragraph break | Blank line | [`parbreak`] | | Paragraph break | Blank line | [`parbreak`] |
| Strong emphasis | `[*strong*]` | [`strong`] | | Strong emphasis | `[*strong*]` | [`strong`] |
| Emphasis | `[_emphasis_]` | [`emph`] | | Emphasis | `[_emphasis_]` | [`emph`] |
| Raw text | ``[`print(1)`]`` | [`raw`] | | Raw text | ``[`print(1)`]`` | [`raw`] |
| Link | `[https://typst.app/]` | [`link`] | | Link | `[https://typst.app/]` | [`link`] |
| Label | `[<intro>]` | [`label`] | | Label | `[<intro>]` | [`label`] |
| Reference | `[@intro]` | [`ref`] | | Reference | `[@intro]` | [`ref`] |
| Heading | `[= Heading]` | [`heading`] | | Heading | `[= Heading]` | [`heading`] |
| Bullet list | `[- item]` | [`list`] | | Bullet list | `[- item]` | [`list`] |
| Numbered list | `[+ item]` | [`enum`] | | Numbered list | `[+ item]` | [`enum`] |
| Term list | `[/ Term: description]` | [`terms`] | | Term list | `[/ Term: description]` | [`terms`] |
| Math | `[$x^2$]` | [Math]($category/math) | | Math | `[$x^2$]` | [Math]($category/math) |
| Line break | `[\]` | [`linebreak`] | | Line break | `[\]` | [`linebreak`] |
| Smart quote | `['single' or "double"]` | [`smartquote`] | | Smart quote | `['single' or "double"]` | [`smartquote`] |
| Symbol shorthand | `[~, ---]` | [Symbols]($category/symbols/sym) | | Symbol shorthand | `[~]`, `[---]` | [Symbols]($category/symbols/sym) |
| Code expression | `[#rect(width: 1cm)]` | [Scripting]($scripting/#expressions) | | Code expression | `[#rect(width: 1cm)]` | [Scripting]($scripting/#expressions) |
| Character escape | `[Tweet at us \#ad]` | [Below](#escapes) | | Character escape | `[Tweet at us \#ad]` | [Below](#escapes) |
| Comment | `[/* block */, // line]` | [Below](#comments) | | Comment | `[/* block */]`, `[// line]` | [Below](#comments) |
## Math mode { #math } ## Math mode { #math }
Math mode is a special markup mode that is used to typeset mathematical Math mode is a special markup mode that is used to typeset mathematical
@ -75,7 +75,7 @@ follows:
| Variable access | `[$#x$, $pi$]` | [Math]($category/math) | | Variable access | `[$#x$, $pi$]` | [Math]($category/math) |
| Field access | `[$arrow.r.long$]` | [Scripting]($scripting/#fields) | | Field access | `[$arrow.r.long$]` | [Scripting]($scripting/#fields) |
| Implied multiplication | `[$x y$]` | [Math]($category/math) | | Implied multiplication | `[$x y$]` | [Math]($category/math) |
| Symbol shorthand | `[$->, !=$]` | [Symbols]($category/symbols/sym) | | Symbol shorthand | `[$->$]`, `[$!=$]` | [Symbols]($category/symbols/sym) |
| Text/string in math | `[$a "is natural"$]` | [Math]($category/math) | | Text/string in math | `[$a "is natural"$]` | [Math]($category/math) |
| Math function call | `[$floor(x)$]` | [Math]($category/math) | | Math function call | `[$floor(x)$]` | [Math]($category/math) |
| Code expression | `[$#rect(width: 1cm)$]` | [Scripting]($scripting/#expressions) | | Code expression | `[$#rect(width: 1cm)$]` | [Scripting]($scripting/#expressions) |
@ -91,11 +91,11 @@ a table listing all syntax that is available in code mode:
| ------------------------ | ----------------------------- | ---------------------------------- | | ------------------------ | ----------------------------- | ---------------------------------- |
| None | `{none}` | [`none`] | | None | `{none}` | [`none`] |
| Auto | `{auto}` | [`auto`] | | Auto | `{auto}` | [`auto`] |
| Boolean | `{false, true}` | [`bool`] | | Boolean | `{false}`, `{true}` | [`bool`] |
| Integer | `{10, 0xff}` | [`int`] | | Integer | `{10}`, `{0xff}` | [`int`] |
| Floating-point number | `{3.14, 1e5}` | [`float`] | | Floating-point number | `{3.14}`, `{1e5}` | [`float`] |
| Length | `{2pt, 3mm, 1em, ..}` | [`length`] | | Length | `{2pt}`, `{3mm}`, `{1em}`, .. | [`length`] |
| Angle | `{90deg, 1rad}` | [`angle`] | | Angle | `{90deg}`, `{1rad}` | [`angle`] |
| Fraction | `{2fr}` | [`fraction`] | | Fraction | `{2fr}` | [`fraction`] |
| Ratio | `{50%}` | [`ratio`] | | Ratio | `{50%}` | [`ratio`] |
| String | `{"hello"}` | [`str`] | | String | `{"hello"}` | [`str`] |
@ -132,7 +132,7 @@ a table listing all syntax that is available in code mode:
| Include module | `{include "bar.typ"}` | [Scripting]($scripting/#modules) | | Include module | `{include "bar.typ"}` | [Scripting]($scripting/#modules) |
| Import module | `{import "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) | | Import items from module | `{import "bar.typ": a, b, c}` | [Scripting]($scripting/#modules) |
| Comment | `[/* block */, // line]` | [Below](#comments) | | Comment | `{/* block */}`, `{// line}` | [Below](#comments) |
## Comments ## Comments
Comments are ignored by Typst and will not be included in the output. This is Comments are ignored by Typst and will not be included in the output. This is