Slightly improve tables in syntax.md (#4151)

This commit is contained in:
Malo 2024-05-16 19:17:10 +02:00 committed by Laurenz
parent 573a2db4be
commit ba1ae1c9a2

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
more about their syntax and usage.
| Name | Example | See |
| ------------------ | ------------------------ | ---------------------------- |
| Paragraph break | Blank line | [`parbreak`] |
| Strong emphasis | `[*strong*]` | [`strong`] |
| Emphasis | `[_emphasis_]` | [`emph`] |
| Raw text | ``[`print(1)`]`` | [`raw`] |
| Link | `[https://typst.app/]` | [`link`] |
| Label | `[<intro>]` | [`label`] |
| Reference | `[@intro]` | [`ref`] |
| Heading | `[= Heading]` | [`heading`] |
| Bullet list | `[- item]` | [`list`] |
| Numbered list | `[+ item]` | [`enum`] |
| Term list | `[/ Term: description]` | [`terms`] |
| Math | `[$x^2$]` | [Math]($category/math) |
| Line break | `[\]` | [`linebreak`] |
| Smart quote | `['single' or "double"]` | [`smartquote`] |
| Symbol shorthand | `[~, ---]` | [Symbols]($category/symbols/sym) |
| Code expression | `[#rect(width: 1cm)]` | [Scripting]($scripting/#expressions) |
| Character escape | `[Tweet at us \#ad]` | [Below](#escapes) |
| Comment | `[/* block */, // line]` | [Below](#comments) |
| Name | Example | See |
| ------------------ | ---------------------------- | ------------------------ |
| Paragraph break | Blank line | [`parbreak`] |
| Strong emphasis | `[*strong*]` | [`strong`] |
| Emphasis | `[_emphasis_]` | [`emph`] |
| Raw text | ``[`print(1)`]`` | [`raw`] |
| Link | `[https://typst.app/]` | [`link`] |
| Label | `[<intro>]` | [`label`] |
| Reference | `[@intro]` | [`ref`] |
| Heading | `[= Heading]` | [`heading`] |
| Bullet list | `[- item]` | [`list`] |
| Numbered list | `[+ item]` | [`enum`] |
| Term list | `[/ Term: description]` | [`terms`] |
| Math | `[$x^2$]` | [Math]($category/math) |
| Line break | `[\]` | [`linebreak`] |
| Smart quote | `['single' or "double"]` | [`smartquote`] |
| Symbol shorthand | `[~]`, `[---]` | [Symbols]($category/symbols/sym) |
| Code expression | `[#rect(width: 1cm)]` | [Scripting]($scripting/#expressions) |
| Character escape | `[Tweet at us \#ad]` | [Below](#escapes) |
| Comment | `[/* block */]`, `[// line]` | [Below](#comments) |
## Math mode { #math }
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) |
| Field access | `[$arrow.r.long$]` | [Scripting]($scripting/#fields) |
| 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) |
| Math function call | `[$floor(x)$]` | [Math]($category/math) |
| 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`] |
| Auto | `{auto}` | [`auto`] |
| Boolean | `{false, true}` | [`bool`] |
| Integer | `{10, 0xff}` | [`int`] |
| Floating-point number | `{3.14, 1e5}` | [`float`] |
| Length | `{2pt, 3mm, 1em, ..}` | [`length`] |
| Angle | `{90deg, 1rad}` | [`angle`] |
| Boolean | `{false}`, `{true}` | [`bool`] |
| Integer | `{10}`, `{0xff}` | [`int`] |
| Floating-point number | `{3.14}`, `{1e5}` | [`float`] |
| Length | `{2pt}`, `{3mm}`, `{1em}`, .. | [`length`] |
| Angle | `{90deg}`, `{1rad}` | [`angle`] |
| Fraction | `{2fr}` | [`fraction`] |
| Ratio | `{50%}` | [`ratio`] |
| 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) |
| 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) |
| Comment | `{/* block */}`, `{// line}` | [Below](#comments) |
## Comments
Comments are ignored by Typst and will not be included in the output. This is