Standardize API doc heading levels

This commit is contained in:
Bruce Hill 2025-03-05 00:11:18 -05:00
parent f330f06c21
commit 665050940f
4 changed files with 49 additions and 49 deletions

View File

@ -3,11 +3,11 @@
Boolean values have the type `Bool` and can be either `yes` ("true") or `no` Boolean values have the type `Bool` and can be either `yes` ("true") or `no`
("false"). ("false").
# Boolean Functions ## Boolean Functions
This documentation provides details on boolean functions available in the API. This documentation provides details on boolean functions available in the API.
## `parse` ### `parse`
**Description:** **Description:**
Converts a string representation of a boolean value into a boolean. Acceptable Converts a string representation of a boolean value into a boolean. Acceptable

View File

@ -1356,7 +1356,7 @@ The Bessel function of the second kind of order 1 of `x`.
--- ---
## `clamped` ### `clamped`
**Description:** **Description:**
Returns the given number clamped between two values so that it is within Returns the given number clamped between two values so that it is within

View File

@ -13,13 +13,13 @@ seeded levels). The default random number generator for Tomo is called `random`
and is, by default, initialized with random data from the operating system when and is, by default, initialized with random data from the operating system when
a Tomo program launches. a Tomo program launches.
# RNG Functions ## RNG Functions
This documentation provides details on RNG functions available in the API. This documentation provides details on RNG functions available in the API.
[Arrays](arrays.md) also have some methods which use RNG values: [Arrays](arrays.md) also have some methods which use RNG values:
`array:shuffle()`, `array:shuffled()`, `array:random()`, and `array:sample()`. `array:shuffle()`, `array:shuffled()`, `array:random()`, and `array:sample()`.
## `bool` ### `bool`
**Description:** **Description:**
Generate a random boolean value with a given probability. Generate a random boolean value with a given probability.
@ -49,7 +49,7 @@ func bool(rng: RNG, p: Num = 0.5 -> Bool)
--- ---
## `byte` ### `byte`
**Description:** **Description:**
Generate a random byte with uniform probability. Generate a random byte with uniform probability.
@ -74,7 +74,7 @@ A random byte (0-255).
--- ---
## `bytes` ### `bytes`
**Description:** **Description:**
Generate an array of uniformly random bytes with the given length. Generate an array of uniformly random bytes with the given length.
@ -100,7 +100,7 @@ An array of length `count` random bytes with uniform random distribution (0-255)
--- ---
## `copy` ### `copy`
**Description:** **Description:**
Return a copy of a random number generator. This copy will be a parallel version of Return a copy of a random number generator. This copy will be a parallel version of
@ -133,7 +133,7 @@ A copy of the given RNG.
--- ---
## `int`, `int64`, `int32`, `int16`, `int8` ### `int`, `int64`, `int32`, `int16`, `int8`
**Description:** **Description:**
Generate a random integer value with the given range. Generate a random integer value with the given range.
@ -165,7 +165,7 @@ is greater than `max`, an error will be raised.
--- ---
## `new` ### `new`
**Description:** **Description:**
Return a new random number generator. Return a new random number generator.
@ -193,7 +193,7 @@ A new random number generator.
--- ---
## `num`, `num32` ### `num`, `num32`
**Description:** **Description:**
Generate a random floating point value with the given range. Generate a random floating point value with the given range.
@ -222,7 +222,7 @@ A floating point number uniformly chosen from the range `[min, max]`
--- ---
## `set_seed` ### `set_seed`
**Description:** **Description:**
Set the seed for an RNG. Set the seed for an RNG.

View File

@ -262,15 +262,15 @@ created that has text with the codepoint `U+E9` as a key, then a lookup with
the same text but with `U+65 U+301` instead of `U+E9` will still succeed in the same text but with `U+65 U+301` instead of `U+E9` will still succeed in
finding the value because the two texts are equivalent under normalization. finding the value because the two texts are equivalent under normalization.
# Patterns ## Patterns
Texts use a custom pattern matching syntax for text matching and replacement as Texts use a custom pattern matching syntax for text matching and replacement as
a lightweight, but powerful alternative to regular expressions. See [the a lightweight, but powerful alternative to regular expressions. See [the
pattern documentation](patterns.md) for more details. pattern documentation](patterns.md) for more details.
# Text Functions ## Text Functions
## `as_c_string` ### `as_c_string`
**Description:** **Description:**
Converts a `Text` value to a C-style string. Converts a `Text` value to a C-style string.
@ -295,7 +295,7 @@ A C-style string (`CString`) representing the text.
--- ---
## `at` ### `at`
**Description:** **Description:**
Get the graphical cluster at a given index. This is similar to `str[i]` with Get the graphical cluster at a given index. This is similar to `str[i]` with
@ -324,7 +324,7 @@ indices are counted from the back of the text, so `-1` means the last cluster,
--- ---
## `by_line` ### `by_line`
**Description:** **Description:**
Returns an iterator function that can be used to iterate over the lines in a Returns an iterator function that can be used to iterate over the lines in a
@ -357,7 +357,7 @@ for line in text:by_line():
--- ---
## `by_match` ### `by_match`
**Description:** **Description:**
Returns an iterator function that can be used to iterate over the occurrences Returns an iterator function that can be used to iterate over the occurrences
@ -388,7 +388,7 @@ for match in text:by_match($/{alpha}/):
--- ---
## `by_split` ### `by_split`
**Description:** **Description:**
Returns an iterator function that can be used to iterate over text separated by Returns an iterator function that can be used to iterate over text separated by
@ -419,7 +419,7 @@ for chunk in text:by_split($/,/):
--- ---
## `bytes` ### `bytes`
**Description:** **Description:**
Converts a `Text` value to an array of bytes representing a UTF8 encoding of Converts a `Text` value to an array of bytes representing a UTF8 encoding of
@ -445,7 +445,7 @@ An array of bytes (`[Byte]`) representing the text in UTF8 encoding.
--- ---
## `codepoint_names` ### `codepoint_names`
**Description:** **Description:**
Returns an array of the names of each codepoint in the text. Returns an array of the names of each codepoint in the text.
@ -470,7 +470,7 @@ An array of codepoint names (`[Text]`).
--- ---
## `utf32_codepoints` ### `utf32_codepoints`
**Description:** **Description:**
Returns an array of Unicode code points for UTF32 encoding of the text. Returns an array of Unicode code points for UTF32 encoding of the text.
@ -495,7 +495,7 @@ An array of 32-bit integer Unicode code points (`[Int32]`).
--- ---
## `each` ### `each`
**Description:** **Description:**
Iterates over each match of a [pattern](patterns.md) and passes the match to Iterates over each match of a [pattern](patterns.md) and passes the match to
@ -526,7 +526,7 @@ None.
--- ---
## `ends_with` ### `ends_with`
**Description:** **Description:**
Checks if the `Text` ends with a literal suffix text. Checks if the `Text` ends with a literal suffix text.
@ -552,7 +552,7 @@ func ends_with(text: Text, suffix: Text -> Bool)
--- ---
## `from_c_string` ### `from_c_string`
**Description:** **Description:**
Converts a C-style string to a `Text` value. Converts a C-style string to a `Text` value.
@ -577,7 +577,7 @@ A `Text` value representing the C-style string.
--- ---
## `from_codepoint_names` ### `from_codepoint_names`
**Description:** **Description:**
Returns text that has the given codepoint names (according to the Unicode Returns text that has the given codepoint names (according to the Unicode
@ -610,7 +610,7 @@ Any invalid names are ignored.
--- ---
## `from_codepoints` ### `from_codepoints`
**Description:** **Description:**
Returns text that has been constructed from the given UTF32 codepoints. Note: Returns text that has been constructed from the given UTF32 codepoints. Note:
@ -637,7 +637,7 @@ A new text with the specified codepoints after normalization has been applied.
--- ---
## `from_bytes` ### `from_bytes`
**Description:** **Description:**
Returns text that has been constructed from the given UTF8 bytes. Note: the Returns text that has been constructed from the given UTF8 bytes. Note: the
@ -664,7 +664,7 @@ A new text based on the input UTF8 bytes after normalization has been applied.
--- ---
## `find` ### `find`
**Description:** **Description:**
Finds the first occurrence of a [pattern](patterns.md) in the given text (if Finds the first occurrence of a [pattern](patterns.md) in the given text (if
@ -699,7 +699,7 @@ struct containing information about the match.
--- ---
## `find_all` ### `find_all`
**Description:** **Description:**
Finds all occurrences of a [pattern](patterns.md) in the given text. Finds all occurrences of a [pattern](patterns.md) in the given text.
@ -738,7 +738,7 @@ Note: if `text` or `pattern` is empty, an empty array will be returned.
--- ---
## `from` ### `from`
**Description:** **Description:**
Get a slice of the text, starting at the given position. Get a slice of the text, starting at the given position.
@ -770,7 +770,7 @@ the length of the string.
--- ---
## `has` ### `has`
**Description:** **Description:**
Checks if the `Text` contains a target [pattern](patterns.md). Checks if the `Text` contains a target [pattern](patterns.md).
@ -802,7 +802,7 @@ func has(text: Text, pattern: Pattern -> Bool)
--- ---
## `join` ### `join`
**Description:** **Description:**
Joins an array of text pieces with a specified glue. Joins an array of text pieces with a specified glue.
@ -828,7 +828,7 @@ A single `Text` value with the pieces joined by the glue.
--- ---
## `lines` ### `lines`
**Description:** **Description:**
Splits the text into an array of lines of text, preserving blank lines, Splits the text into an array of lines of text, preserving blank lines,
@ -862,7 +862,7 @@ An array of substrings resulting from the split.
--- ---
## `lower` ### `lower`
**Description:** **Description:**
Converts all characters in the text to lowercase. Converts all characters in the text to lowercase.
@ -887,7 +887,7 @@ The lowercase version of the text.
--- ---
## `matches` ### `matches`
**Description:** **Description:**
Checks if the `Text` matches target [pattern](patterns.md) and returns an array Checks if the `Text` matches target [pattern](patterns.md) and returns an array
@ -919,7 +919,7 @@ or a null value otherwise.
--- ---
## `map` ### `map`
**Description:** **Description:**
For each occurrence of the given [pattern](patterns.md), replace the text with For each occurrence of the given [pattern](patterns.md), replace the text with
@ -952,7 +952,7 @@ function to each.
--- ---
## `quoted` ### `quoted`
**Description:** **Description:**
Formats the text as a quoted string. Formats the text as a quoted string.
@ -978,7 +978,7 @@ The text formatted as a quoted string.
--- ---
## `repeat` ### `repeat`
**Description:** **Description:**
Repeat some text multiple times. Repeat some text multiple times.
@ -1004,7 +1004,7 @@ The text repeated the given number of times.
--- ---
## `replace` ### `replace`
**Description:** **Description:**
Replaces occurrences of a [pattern](patterns.md) in the text with a replacement Replaces occurrences of a [pattern](patterns.md) in the text with a replacement
@ -1070,7 +1070,7 @@ The text with occurrences of the pattern replaced.
--- ---
## `replace_all` ### `replace_all`
**Description:** **Description:**
Takes a table mapping [patterns](patterns.md) to replacement texts and performs Takes a table mapping [patterns](patterns.md) to replacement texts and performs
@ -1119,7 +1119,7 @@ replacement text.
--- ---
## `reversed` ### `reversed`
**Description:** **Description:**
Return a text that has the grapheme clusters in reverse order. Return a text that has the grapheme clusters in reverse order.
@ -1144,7 +1144,7 @@ A reversed version of the text.
--- ---
## `slice` ### `slice`
**Description:** **Description:**
Get a slice of the text. Get a slice of the text.
@ -1180,7 +1180,7 @@ the string.
--- ---
## `split` ### `split`
**Description:** **Description:**
Splits the text into an array of substrings based on a [pattern](patterns.md). Splits the text into an array of substrings based on a [pattern](patterns.md).
@ -1216,7 +1216,7 @@ An array of substrings resulting from the split.
--- ---
## `starts_with` ### `starts_with`
**Description:** **Description:**
Checks if the `Text` starts with a literal prefix text. Checks if the `Text` starts with a literal prefix text.
@ -1242,7 +1242,7 @@ func starts_with(text: Text, prefix: Text -> Bool)
--- ---
## `title` ### `title`
**Description:** **Description:**
Converts the text to title case (capitalizing the first letter of each word). Converts the text to title case (capitalizing the first letter of each word).
@ -1267,7 +1267,7 @@ The text in title case.
--- ---
## `to` ### `to`
**Description:** **Description:**
Get a slice of the text, ending at the given position. Get a slice of the text, ending at the given position.
@ -1299,7 +1299,7 @@ the string.
--- ---
## `trim` ### `trim`
**Description:** **Description:**
Trims the matching [pattern](patterns.md) from the left and/or right side of the text. Trims the matching [pattern](patterns.md) from the left and/or right side of the text.
@ -1333,7 +1333,7 @@ The text without the trim pattern at either end.
--- ---
## `upper` ### `upper`
**Description:** **Description:**
Converts all characters in the text to uppercase. Converts all characters in the text to uppercase.