Skip to content

Commit 75b9866

Browse files
docs(color and print): Updated color.md with underline macro and print.md with the string length
1 parent 5be8c8d commit 75b9866

2 files changed

Lines changed: 16 additions & 5 deletions

File tree

src/io/colors.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ int main() {
4444
## Mixing Colors and Styles
4545

4646
You can stack multiple macros together to combine colors with text formatting,
47-
such as making a cyan string bold. Just separate them with a space.
47+
such as making a string bold or underlining a URL. Just separate them with a
48+
space.
4849

4950
```c
5051
#include <nextstd/ns.h>
@@ -54,8 +55,8 @@ int main() {
5455
// Bold and Cyan text
5556
ns_println(NS_COLOR_BOLD NS_COLOR_CYAN "Starting NextStd Server..." NS_COLOR_RESET);
5657

57-
// Standard Magenta text
58-
ns_println(NS_COLOR_MAGENTA "https://github.com/NextStd/nextstd" NS_COLOR_RESET);
58+
// Underlined Magenta text
59+
ns_println(NS_COLOR_UNDERLINE NS_COLOR_MAGENTA "https://github.com/NextStd/nextstd" NS_COLOR_RESET);
5960

6061
return 0;
6162
}
@@ -68,7 +69,7 @@ changes the color of **all subsequent text** until it receives a reset command.
6869

6970
If you forget to include `NS_COLOR_RESET` at the end of your `ns_println` call,
7071
every single thing your program (and potentially your user's terminal prompt)
71-
prints afterward will be stuck in that color!
72+
prints afterward will be stuck in that format!
7273

7374
## Available Macros Reference
7475

@@ -87,6 +88,7 @@ Here is a list of the standard text styling macros available in `ns_color.h`:
8788
**Styles:**
8889

8990
* `NS_COLOR_BOLD`
91+
* `NS_COLOR_UNDERLINE`
9092

9193
**State Control:**
9294

src/string/lifecycle.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,16 @@ Fortunately, you don't have to manually extract it. Because `ns_print` and
4747
`ns_println` handle `ns_string` objects natively via C11 `_Generic` macros, you
4848
can simply pass the entire struct directly to print your managed string!
4949

50+
You can also print struct properties like `len` seamlessly since `ns_io`
51+
natively supports C's `size_t` type.
52+
5053
```c
5154
// 2. Use the string
5255
ns_print("Message: ");
5356
ns_println(my_text); // No need to access inner pointers!
57+
58+
ns_print("Length: ");
59+
ns_println(my_text.len); // Prints size_t seamlessly
5460
```
5561
5662
## 3. Destruction (`ns_string_free`)
@@ -93,7 +99,10 @@ int main() {
9399

94100
// 2. Usage
95101
ns_print("The string is: ");
96-
ns_println(greeting); // Magically works!
102+
ns_println(greeting);
103+
104+
ns_print("Length: ");
105+
ns_println(greeting.len);
97106

98107
} NS_EXCEPT(err, NS_ERROR_ANY) {
99108
ns_print("Error: ");

0 commit comments

Comments
 (0)