Skip to content

Commit e96b18d

Browse files
committed
fix errors in doc formatting
1 parent d6ec16d commit e96b18d

File tree

3 files changed

+80
-68
lines changed

3 files changed

+80
-68
lines changed

doc/11-Expand-Panel.md

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
-------------------
2-
# 11 Expand Panel
3-
-------------------
1+
--------------------
2+
\# 11 Expand Panel
3+
--------------------
44

55
An expand panel is a collapsible container that can show or hide its
66
content. It consists of a clickable header (which always displays) and a
@@ -27,8 +27,8 @@ hover).
2727

2828
## ExpandPanelCfg
2929

30-
The `expand_panel` view is created with an `ExpandPanelCfg` structure. The most important fields are:
31-
Important fields:
30+
The `expand_panel` view is created with an `ExpandPanelCfg` structure.
31+
The most important fields are: Important fields:
3232

3333
- `id string` --- Optional identifier for the view.
3434
- `head View` --- The header content (required). This is a view that
@@ -67,13 +67,18 @@ Important fields:
6767

6868
## Interaction model
6969

70-
- **Click**: Clicking anywhere in the header row triggers the `on_toggle` callback if it is provided.
71-
- **Hover**: When the pointer is over the header, the mouse cursor changes to a pointing hand, and the header background uses the theme's `color_hover`.
72-
- **Arrow indicator**: The header automatically shows `icon_arrow_up` when `open` is `true` and `icon_arrow_down` when `open` is `false`.
70+
- **Click**: Clicking anywhere in the header row triggers the
71+
`on_toggle` callback if it is provided.
72+
- **Hover**: When the pointer is over the header, the mouse cursor
73+
changes to a pointing hand, and the header background uses the theme's
74+
`color_hover`.
75+
- **Arrow indicator**: The header automatically shows `icon_arrow_up`
76+
when `open` is `true` and `icon_arrow_down` when `open` is `false`.
7377

7478
## `expand_panel`
7579

76-
This function creates the expand panel view from the given `ExpandPanelCfg`.
80+
This function creates the expand panel view from the given
81+
`ExpandPanelCfg`.
7782

7883
## Basic example
7984

doc/13-Input-Date.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
---
1+
------------------------------------------------------------------------
22

33
\# 13 Input Date
44

5-
---
5+
------------------------------------------------------------------------
66

77
The `input_date` view combines an `input` field with a `date_picker` to
88
create a user-friendly date entry component. It displays the selected
@@ -17,7 +17,7 @@ clicks the calendar icon.
1717

1818
Here's how to create a simple date input field:
1919

20-
```v
20+
``` v
2121
// inside your main view function
2222
window.input_date(
2323
id: 'appointment_date'
@@ -36,22 +36,22 @@ window.input_date(
3636
This function creates the date input view. It internally manages the
3737
visibility of the floating `date_picker`.
3838

39-
```v
39+
``` v
4040
fn (mut window Window) input_date(cfg InputDateCfg) View
4141
```
4242

4343
The view is composed of:
4444

4545
- An `input` view that displays the formatted date.
46-
- A calendar `icon` within the input. - A floating `date_picker`
47-
view that appears below the input when the icon is clicked.
46+
- A calendar `icon` within the input. - A floating `date_picker` view
47+
that appears below the input when the icon is clicked.
4848

4949
## `InputDateCfg`
5050

5151
This struct configures the `input_date` view. It shares many properties
5252
with `DatePickerCfg` and `InputCfg`.
5353

54-
```v
54+
``` v
5555
@[heap]
5656
pub struct InputDateCfg {
5757
pub:
@@ -108,16 +108,16 @@ pub:
108108
Key points:
109109

110110
- The `date` field holds the currently selected `time.Time`.
111-
- The `on_select` callback is triggered when a user picks a
112-
date from the calendar. This is where you should update your
113-
application's state.
114-
- The `on_enter` callback is tied to the input
115-
field, allowing actions when the user presses the Enter key.
116-
- Most of the date-picker-specific configurations (like `allowed_weekdays`,
117-
`select_multiple`, etc.) are passed directly to the underlying
118-
`date_picker` view.
119-
- Styling properties are inherited from the theme's
120-
`input_style` and `date_picker_style`.
111+
- The `on_select` callback is triggered when a user picks a date from
112+
the calendar. This is where you should update your application's
113+
state.
114+
- The `on_enter` callback is tied to the input field, allowing actions
115+
when the user presses the Enter key.
116+
- Most of the date-picker-specific configurations (like
117+
`allowed_weekdays`, `select_multiple`, etc.) are passed directly to
118+
the underlying `date_picker` view.
119+
- Styling properties are inherited from the theme's `input_style` and
120+
`date_picker_style`.
121121

122122
## Events
123123

doc/14-List-Box.md

Lines changed: 49 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
----------------
2-
# 14 List Box
3-
----------------
1+
----------------
2+
\# 14 List Box
3+
----------------
44

5-
A list box is a view that displays a scrollable list of items, allowing users to select
6-
one or multiple options. It's a convenient composition of `column` and `row` views,
7-
pre-configured to handle selection, hover states, and subheadings.
5+
A list box is a view that displays a scrollable list of items, allowing
6+
users to select one or multiple options. It's a convenient composition
7+
of `column` and `row` views, pre-configured to handle selection, hover
8+
states, and subheadings.
89

910
- Widget: `list_box`
1011
- Config: `ListBoxCfg`
@@ -15,7 +16,7 @@ pre-configured to handle selection, hover states, and subheadings.
1516

1617
Here's how to create a simple list box with a few options:
1718

18-
```v
19+
``` v
1920
gui.list_box(
2021
id: 'cities_list'
2122
selected: [app.selected_city]
@@ -35,21 +36,22 @@ gui.list_box(
3536

3637
## `list_box`
3738

38-
This function creates the list box view. It is a specialized container that renders a list
39-
of `ListBoxOption` items and manages their selection state.
39+
This function creates the list box view. It is a specialized container
40+
that renders a list of `ListBoxOption` items and manages their selection
41+
state.
4042

41-
```v
43+
``` v
4244
pub fn list_box(cfg ListBoxCfg) View
4345
```
4446

45-
Internally, it's a `column` with a border, containing another scrollable `column` that
46-
holds a `row` for each item.
47+
Internally, it's a `column` with a border, containing another scrollable
48+
`column` that holds a `row` for each item.
4749

4850
## `ListBoxCfg`
4951

5052
This struct configures the `list_box` view.
5153

52-
```v
54+
``` v
5355
pub struct ListBoxCfg {
5456
pub:
5557
id string
@@ -80,22 +82,21 @@ pub:
8082
}
8183
```
8284

83-
Key fields:
84-
- `data`: An array of `ListBoxOption` structs that define the items in the list.
85-
- `selected`: An array of strings holding the `value` of each selected item.
86-
- `on_select`: The callback triggered when an item is clicked. It receives an array of the
87-
currently selected values.
88-
- `multiple`: If `true`, allows selecting more than one item.
89-
- `id_scroll`: A non-zero value makes the list box scrollable if its content exceeds its
90-
height.
91-
- `subheading_style`: A separate `TextStyle` for items that are subheadings.
85+
Key fields: - `data`: An array of `ListBoxOption` structs that define
86+
the items in the list. - `selected`: An array of strings holding the
87+
`value` of each selected item. - `on_select`: The callback triggered
88+
when an item is clicked. It receives an array of the currently selected
89+
values. - `multiple`: If `true`, allows selecting more than one item. -
90+
`id_scroll`: A non-zero value makes the list box scrollable if its
91+
content exceeds its height. - `subheading_style`: A separate `TextStyle`
92+
for items that are subheadings.
9293

9394
## `ListBoxOption`
9495

95-
This struct defines a single item in the list. Use the `list_box_option` helper for
96-
concise creation.
96+
This struct defines a single item in the list. Use the `list_box_option`
97+
helper for concise creation.
9798

98-
```v
99+
``` v
99100
pub struct ListBoxOption {
100101
pub:
101102
name string
@@ -107,39 +108,44 @@ pub fn list_box_option(name string, value string) ListBoxOption
107108

108109
### Subheadings
109110

110-
If an option's `name` starts with `---`, it is rendered as a non-selectable subheading.
111-
The three leading hyphens are removed, and the rest of the name is displayed using the
112-
`subheading_style`. A horizontal line is drawn below it.
111+
If an option's `name` starts with `---`, it is rendered as a
112+
non-selectable subheading. The three leading hyphens are removed, and
113+
the rest of the name is displayed using the `subheading_style`. A
114+
horizontal line is drawn below it.
113115

114-
```v
116+
``` v
115117
gui.list_box_option('---Category 1', '') // The value is ignored
116118
```
117119

118120
## Interaction and Events
119121

120-
- **Click**: Clicking an item triggers the `on_select` callback. The callback receives a new
121-
array of selected values. If `multiple` is `false`, the new selection replaces the old
122-
one. If `true`, the clicked item is toggled in the selection.
123-
- **Hover**: Hovering over a selectable item changes its background to `color_hover` and
124-
the cursor to a pointing hand.
125-
- **Selection**: Selected items are highlighted with the `color_select` background color.
122+
- **Click**: Clicking an item triggers the `on_select` callback. The
123+
callback receives a new array of selected values. If `multiple` is
124+
`false`, the new selection replaces the old one. If `true`, the
125+
clicked item is toggled in the selection.
126+
- **Hover**: Hovering over a selectable item changes its background to
127+
`color_hover` and the cursor to a pointing hand.
128+
- **Selection**: Selected items are highlighted with the `color_select`
129+
background color.
126130

127131
## Styling
128132

129-
The list box's appearance is controlled by `gui_theme.list_box_style` and can be
130-
overridden in `ListBoxCfg`.
133+
The list box's appearance is controlled by `gui_theme.list_box_style`
134+
and can be overridden in `ListBoxCfg`.
131135

132-
- The outer container is styled with `color_border`, `padding_border`, and `radius_border`.
136+
- The outer container is styled with `color_border`, `padding_border`,
137+
and `radius_border`.
133138
- The inner container uses `color`, `padding`, and `radius`.
134139
- Selected items use `color_select`.
135140
- Text uses `text_style`, and subheadings use `subheading_style`.
136141

137142
## Multiple Selections
138143

139-
To allow users to select multiple items, set `multiple: true`. The `on_select` callback
140-
will receive an array containing all selected values.
144+
To allow users to select multiple items, set `multiple: true`. The
145+
`on_select` callback will receive an array containing all selected
146+
values.
141147

142-
```v
148+
``` v
143149
gui.list_box(
144150
multiple: true
145151
selected: app.selected_items // e.g., ['ny', 'chi']
@@ -153,6 +159,7 @@ gui.list_box(
153159

154160
## See Also
155161

156-
- `08-Container-View.md` --- Understanding the underlying `column` and `row` views.
162+
- `08-Container-View.md` --- Understanding the underlying `column` and
163+
`row` views.
157164
- `05-Themes-Styles.md` --- Details on colors, padding, and styling.
158165
- `view_select.v` --- For a compact, drop-down selection menu.

0 commit comments

Comments
 (0)