diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-04-25 15:50:12 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-04-25 15:50:12 -0400 |
| commit | 4209822ce7e7842adb8f9892c8a988c598050397 (patch) | |
| tree | 2a4d84f23ad51bde116e6ca9b0818192480db149 /docs/text.md | |
| parent | c0c0b8f3b595967bd72df79a8c1f07db358b0741 (diff) | |
Update text docs for escaping
Diffstat (limited to 'docs/text.md')
| -rw-r--r-- | docs/text.md | 25 |
1 files changed, 4 insertions, 21 deletions
diff --git a/docs/text.md b/docs/text.md index 45ee9a09..f716de36 100644 --- a/docs/text.md +++ b/docs/text.md @@ -46,7 +46,7 @@ codepoints." Here are some examples: - `家` (Japanese for "house") is a single codepoint (`CJK Unified Ideograph-5BB6`) that is also a grapheme cluster, so it would be represented as the number `23478` --`👩🏽🚀` is a single graphical cluster, but it's made up of several +- `👩🏽🚀` is a single graphical cluster, but it's made up of several combining codepoints (`["WOMAN", "EMOJI MODIFIER FITZPATRICK TYPE-4", "ZERO WITDH JOINER", "ROCKET"]`). Since this can't be represented with a single codepoint, we must create a synthetic codepoint for it. If this was the `n`th @@ -130,26 +130,9 @@ str := 'Sum: $(1 + 2)' ### Text Escapes -Unlike other languages, backslash is *not* a special character inside of text. -For example, `"x\ny"` has the characters `x`, `\`, `n`, `y`, not a newline. -Instead, a series of character escapes act as complete text literals without -quotation marks: - -``` -newline := \n -crlf := \r\n -quote := \" -``` - -These text literals can be used as interpolation values with or without -parentheses, depending on which you find more readable: - -``` -two_lines := "one\ntwo" -has_quotes := "some $\"quotes$\" here" -``` - -However, in general it is best practice to use multi-line text to avoid these problems: +Like other languages, backslash is a special character inside of text for +escape sequences like `\n`. However, in general it is best practice to use +multi-line text if you need to add a newline. ``` str := " |
