@aigne/doc-smith 0.8.14 → 0.8.15-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/agents/update/check-document.mjs +15 -0
- package/agents/update/index.yaml +1 -1
- package/agents/utils/choose-docs.mjs +6 -1
- package/agents/utils/load-sources.mjs +80 -22
- package/agents/utils/transform-detail-datasources.mjs +24 -2
- package/package.json +1 -1
- package/prompts/detail/custom/custom-components.md +247 -153
- package/prompts/detail/d2-diagram/system-prompt.md +33 -7
- package/prompts/detail/generate/detail-example.md +24 -8
- package/prompts/detail/generate/document-rules.md +4 -5
- package/prompts/detail/generate/user-prompt.md +37 -0
- package/prompts/structure/generate/user-prompt.md +34 -0
- package/prompts/translate/code-block.md +14 -7
- package/prompts/translate/translate-document.md +111 -7
- package/utils/file-utils.mjs +83 -7
- package/utils/openapi/index.mjs +24 -0
|
@@ -1,19 +1,11 @@
|
|
|
1
1
|
<custom_components_usage>
|
|
2
2
|
When generating document details, you can use the following custom components at appropriate locations based on their descriptions and functionality to enhance document presentation:
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
- `<x-cards>`
|
|
6
|
-
- `<x-field>`
|
|
7
|
-
- `<x-field-desc>`
|
|
8
|
-
- `<x-field-group>`
|
|
9
|
-
|
|
10
|
-
## `<x-card>` Single Card Component
|
|
4
|
+
## XCard: Individual link display card
|
|
11
5
|
|
|
12
6
|
Suitable for displaying individual links with a richer and more visually appealing presentation format.
|
|
13
7
|
|
|
14
|
-
###
|
|
15
|
-
|
|
16
|
-
Attributes:
|
|
8
|
+
### Attributes
|
|
17
9
|
|
|
18
10
|
- `data-title` (required): Card title.
|
|
19
11
|
- `data-icon` (optional): Icon identifier (e.g., lucide:icon-name or material-symbols:rocket-outline).
|
|
@@ -25,84 +17,80 @@ Attributes:
|
|
|
25
17
|
- `data-horizontal` (optional): Whether to use horizontal layout.
|
|
26
18
|
- `data-cta` (optional): Button text (call to action).
|
|
27
19
|
|
|
28
|
-
|
|
20
|
+
### Children
|
|
29
21
|
|
|
30
22
|
- Must be written within `<x-card>...</x-card>` children.
|
|
31
|
-
-
|
|
23
|
+
- **Plain Text Only**: All markdown formatting is prohibited, including inline formats like `code`, **bold**, _italic_, [links](), and block-level formats like headers (# ##), lists (- \*), code blocks (```), tables (|), and any other markdown syntax. Only plain text content is allowed.
|
|
32
24
|
|
|
33
|
-
### Examples
|
|
25
|
+
### Good Examples
|
|
34
26
|
|
|
35
|
-
<card_good_examples>
|
|
36
27
|
Example 1: Basic card with icon and description
|
|
37
28
|
|
|
38
|
-
```
|
|
29
|
+
```md
|
|
39
30
|
<x-card data-title="alarm()" data-icon="lucide:alarm-clock"> SIGALRM: Sent when a real-time timer has expired. </x-card>
|
|
40
31
|
```
|
|
41
32
|
|
|
42
33
|
Example 2: Horizontal card layout
|
|
43
34
|
|
|
44
|
-
```
|
|
35
|
+
```md
|
|
45
36
|
<x-card data-title="Horizontal card" data-icon="lucide:atom" data-horizontal="true">
|
|
46
37
|
This is an example of a horizontal card.
|
|
47
38
|
</x-card>
|
|
48
39
|
```
|
|
49
40
|
|
|
50
|
-
|
|
41
|
+
### Bad Examples
|
|
51
42
|
|
|
52
|
-
|
|
53
|
-
Example 1: Markdown formatting in card content
|
|
43
|
+
Example 1: Inline Markdown formatting in card content
|
|
54
44
|
|
|
55
|
-
```
|
|
45
|
+
```md
|
|
56
46
|
<x-card data-title="alarm()" data-icon="lucide:alarm-clock"> `SIGALRM`: Sent when a real-time timer has expired. </x-card>
|
|
57
47
|
```
|
|
58
48
|
|
|
59
49
|
Example 2: Code block inside card content
|
|
60
50
|
|
|
61
|
-
```
|
|
51
|
+
```md
|
|
62
52
|
<x-card data-title="ctrl_break()" data-icon="lucide:keyboard">
|
|
63
53
|
Creates a listener for "ctrl-break" events.
|
|
64
54
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
55
|
+
\`\`\`rust
|
|
56
|
+
use tokio::signal::windows::ctrl_break;
|
|
57
|
+
|
|
58
|
+
#[tokio::main]
|
|
59
|
+
async fn main() -> std::io::Result<()> {
|
|
60
|
+
let mut stream = ctrl_break()?;
|
|
61
|
+
stream.recv().await;
|
|
62
|
+
println!("got ctrl-break");
|
|
63
|
+
Ok(())
|
|
64
|
+
}
|
|
65
|
+
\`\`\`
|
|
76
66
|
</x-card>
|
|
77
67
|
```
|
|
78
68
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
## `<x-cards>` Card List Component
|
|
69
|
+
## XCards: Multiple cards container
|
|
82
70
|
|
|
83
71
|
Suitable for displaying multiple links using a card list format, providing a richer and more visually appealing presentation.
|
|
84
72
|
|
|
85
|
-
###
|
|
86
|
-
|
|
87
|
-
Attributes:
|
|
73
|
+
### Attributes
|
|
88
74
|
|
|
89
75
|
- data-columns (optional): Number of columns, integer (e.g., 2, 3). Default is 2.
|
|
90
76
|
- Must contain multiple <x-card> elements internally.
|
|
91
77
|
|
|
92
|
-
|
|
78
|
+
### Children
|
|
93
79
|
|
|
94
80
|
- Must contain multiple <x-card> elements internally.
|
|
95
|
-
|
|
81
|
+
|
|
82
|
+
### Usage Rules
|
|
83
|
+
|
|
84
|
+
- **Visual Consistency**: All <x-card> elements within the same <x-cards> must maintain visual consistency:
|
|
96
85
|
- It's recommended to always provide data-icon for each card.
|
|
97
86
|
- Or all cards should have data-image.
|
|
98
87
|
- Avoid mixing (some with icons, some with only images).
|
|
99
88
|
|
|
100
|
-
### Examples
|
|
89
|
+
### Good Examples
|
|
101
90
|
|
|
102
|
-
<cards_good_examples>
|
|
103
91
|
Example 1: Three-column cards with icons
|
|
104
92
|
|
|
105
|
-
```
|
|
93
|
+
```md
|
|
106
94
|
<x-cards data-columns="3">
|
|
107
95
|
<x-card data-title="Feature 1" data-icon="lucide:rocket">Description of Feature 1.</x-card>
|
|
108
96
|
<x-card data-title="Feature 2" data-icon="lucide:bolt">Description of Feature 2.</x-card>
|
|
@@ -112,234 +100,326 @@ Example 1: Three-column cards with icons
|
|
|
112
100
|
|
|
113
101
|
Example 2: Two-column cards with images
|
|
114
102
|
|
|
115
|
-
```
|
|
103
|
+
```md
|
|
116
104
|
<x-cards data-columns="2">
|
|
117
|
-
<x-card data-title="Card A" data-image="https://picsum.photos/id/10/300/300">Content A</x-card>
|
|
118
|
-
<x-card data-title="Card B" data-image="https://picsum.photos/id/11/300/300">Content B</x-card>
|
|
105
|
+
<x-card data-title="Card A" data-image="https://picsum.photos/id/10/300/300">Content A</x-card>
|
|
106
|
+
<x-card data-title="Card B" data-image="https://picsum.photos/id/11/300/300">Content B</x-card>
|
|
119
107
|
</x-cards>
|
|
120
108
|
```
|
|
121
109
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
## `<x-field>` Individual Field Component
|
|
110
|
+
## XField: Structured data field
|
|
125
111
|
|
|
126
112
|
Suitable for displaying API parameters, return values, context data, and any structured data with metadata in a clean, organized format. Supports nested structures for complex data types.
|
|
127
113
|
|
|
128
|
-
###
|
|
129
|
-
|
|
130
|
-
Attributes:
|
|
114
|
+
### Attributes
|
|
131
115
|
|
|
132
116
|
- `data-name` (optional): The name of the field/parameter
|
|
133
|
-
- `data-type` (optional): The data type of the field (e.g., "string", "number", "boolean", "object", "array")
|
|
117
|
+
- `data-type` (optional): The data type of the field (e.g., "string", "number", "boolean", "symbol", "object", "array", "function")
|
|
134
118
|
- `data-default` (optional): Default value for the field
|
|
135
119
|
- `data-required` (optional): Whether the field is required ("true" or "false")
|
|
136
120
|
- `data-deprecated` (optional): Whether the field is deprecated ("true" or "false")
|
|
137
121
|
- `data-desc` (optional): Simple description of the field (plain text only)
|
|
138
|
-
- Mutually exclusive with `data-desc`: Use either `data-desc` attribute OR `<x-field-desc>` element, not both
|
|
139
122
|
|
|
140
|
-
|
|
123
|
+
### Children
|
|
141
124
|
|
|
142
125
|
- For simple types (string, number, boolean): children can be empty or contain exactly one `<x-field-desc>` element
|
|
143
126
|
- For complex types (object, array), children contain nested `<x-field>` elements and optionally one `<x-field-desc>` element
|
|
144
|
-
- Maximum nesting depth: 5 levels (to avoid overly complex structures)
|
|
145
|
-
- Only one `<x-field-desc>` element per `<x-field>` is allowed
|
|
146
|
-
- **Always use opening/closing tags format**: `<x-field ...></x-field>` for all types
|
|
147
127
|
|
|
148
|
-
###
|
|
128
|
+
### Usage Rules
|
|
129
|
+
|
|
130
|
+
- **Opening/Closing Tags Format**: `<x-field ...></x-field>` for all types
|
|
131
|
+
- **Maximum Nesting Depth**: 5 levels (to avoid overly complex structures)
|
|
132
|
+
- **Description Mutually Exclusive**: Use either `data-desc` attribute OR `<x-field-desc>` element, not both
|
|
133
|
+
- **Single Description Rule**: Only one `<x-field-desc>` element per `<x-field>` is allowed
|
|
134
|
+
- **Grouping Requirement**: Wrap the outermost `<x-field>` elements with `<x-field-group>`, even if there's only one `<x-field>` element
|
|
135
|
+
- **Recursive Structure**: Use recursive `<x-field>` structures to fully express complex object type hierarchies, decomposing all nested properties into more fundamental types
|
|
136
|
+
- **Fixed Value Fields**: For fields that accept a limited set of predefined values (including enums, constants, or fixed strings), use `<x-field>` with the base data type (e.g., "string", "number") in the `data-type` attribute, and list all possible values in the description.
|
|
137
|
+
- **Function-Type Fields**: For fields with `data-type="function"`, nest `<x-field>` elements for parameters (`data-name="parameters"`) and return value (`data-name="returnValue"`) **whenever their types are available**.
|
|
138
|
+
|
|
139
|
+
### Good Examples
|
|
149
140
|
|
|
150
|
-
<field_good_examples>
|
|
151
141
|
Example 1: Simple field with all attributes
|
|
152
142
|
|
|
153
|
-
```
|
|
154
|
-
|
|
143
|
+
```md
|
|
144
|
+
### Returns
|
|
145
|
+
|
|
146
|
+
<x-field-group>
|
|
147
|
+
<x-field data-name="user_id" data-type="string" data-default="u0911" data-required="true" data-deprecated="true" data-desc="Unique identifier for the user. Must be a valid UUID v4 format."></x-field>
|
|
148
|
+
</x-field-group>
|
|
155
149
|
```
|
|
156
150
|
|
|
157
151
|
Example 2: Field with markdown description
|
|
158
152
|
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
153
|
+
```md
|
|
154
|
+
### Context
|
|
155
|
+
|
|
156
|
+
<x-field-group>
|
|
157
|
+
<x-field data-name="api_key" data-type="string" data-required="true">
|
|
158
|
+
<x-field-desc markdown>Your **API key** for authentication. Generate one from the `Settings > API Keys` section. Keep it secure and never expose it in client-side code.</x-field-desc>
|
|
159
|
+
</x-field>
|
|
160
|
+
</x-field-group>
|
|
163
161
|
```
|
|
164
162
|
|
|
165
163
|
Example 3: Nested object structure
|
|
166
164
|
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
<x-field
|
|
173
|
-
|
|
165
|
+
```md
|
|
166
|
+
### Properties
|
|
167
|
+
|
|
168
|
+
<x-field-group>
|
|
169
|
+
<x-field data-name="session" data-type="object" data-required="true">
|
|
170
|
+
<x-field-desc markdown>Contains all **authentication** and **authorization** data for the current user session. This object is automatically populated after successful login.</x-field-desc>
|
|
171
|
+
<x-field data-name="user" data-type="object" data-required="true" data-desc="User basic information">
|
|
172
|
+
<x-field data-name="name" data-type="string" data-required="true" data-default="John Doe" data-desc="User name"></x-field>
|
|
173
|
+
<x-field data-name="email" data-type="string" data-required="true" data-default="john.doe@example.com">
|
|
174
|
+
<x-field-desc markdown>Primary email address used for **login** and **notifications**. Must be a valid email format.</x-field-desc>
|
|
175
|
+
</x-field>
|
|
176
|
+
<x-field data-name="avatar" data-type="string" data-required="false" data-default="https://example.com/avatars/john-doe.jpg" data-desc="User avatar URL"></x-field>
|
|
177
|
+
</x-field>
|
|
178
|
+
<x-field data-name="permissions" data-type="array" data-required="true" data-default='["read", "write", "admin"]'>
|
|
179
|
+
<x-field-desc markdown>Array of **permission strings** that determine what actions the user can perform. Common values: `"read"`, `"write"`, `"admin"`, `"delete"`.</x-field-desc>
|
|
174
180
|
</x-field>
|
|
175
|
-
<x-field data-name="avatar" data-type="string" data-required="false" data-default="https://example.com/avatars/john-doe.jpg" data-desc="User avatar URL"></x-field>
|
|
176
|
-
</x-field>
|
|
177
|
-
<x-field data-name="permissions" data-type="array" data-required="true" data-default='["read", "write", "admin"]'>
|
|
178
|
-
<x-field-desc markdown>Array of **permission strings** that determine what actions the user can perform. Common values: `"read"`, `"write"`, `"admin"`, `"delete"`.</x-field-desc>
|
|
179
181
|
</x-field>
|
|
180
|
-
</x-field>
|
|
182
|
+
</x-field-group>
|
|
181
183
|
```
|
|
182
184
|
|
|
183
|
-
|
|
185
|
+
Example 4: Multiple fields for Parameters
|
|
184
186
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
+
```md
|
|
188
|
+
### Parameters
|
|
187
189
|
|
|
190
|
+
<x-field-group>
|
|
191
|
+
<x-field data-name="user_id" data-type="string" data-required="true" data-desc="Unique identifier for the user. Must be a valid UUID v4 format."></x-field>
|
|
192
|
+
<x-field data-name="include_profile" data-type="boolean" data-required="false" data-default="false" data-desc="Whether to include the user's profile information in the response"></x-field>
|
|
193
|
+
<x-field data-name="options" data-type="object" data-required="false" data-desc="Additional options for the request">
|
|
194
|
+
<x-field data-name="format" data-type="string" data-required="false" data-default="json">
|
|
195
|
+
<x-field-desc>Response format: `json` or `xml`</x-field-desc>
|
|
196
|
+
</x-field>
|
|
197
|
+
<x-field data-name="locale" data-type="string" data-required="false" data-default="en" data-desc="Language locale for localized content"></x-field>
|
|
198
|
+
</x-field>
|
|
199
|
+
</x-field-group>
|
|
188
200
|
```
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
201
|
+
|
|
202
|
+
Example 5: Enum values with base type and description
|
|
203
|
+
|
|
204
|
+
```md
|
|
205
|
+
### Status
|
|
206
|
+
|
|
207
|
+
<x-field-group>
|
|
208
|
+
<x-field data-name="status" data-type="string" data-required="true" data-default="pending" data-desc="Current status of the request. Possible values: 'pending', 'processing', 'completed', 'failed'"></x-field>
|
|
209
|
+
<x-field data-name="priority" data-type="number" data-required="false" data-default="1">
|
|
210
|
+
<x-field-desc markdown>Priority level for the task. **Valid values**: `1` (low), `2` (medium), `3` (high), `4` (urgent)</x-field-desc>
|
|
211
|
+
</x-field>
|
|
212
|
+
</x-field-group>
|
|
193
213
|
```
|
|
194
214
|
|
|
195
|
-
Example
|
|
215
|
+
Example 6: Function type field with nested parameters and return value
|
|
216
|
+
|
|
217
|
+
```md
|
|
218
|
+
### API Methods
|
|
196
219
|
|
|
220
|
+
<x-field-group>
|
|
221
|
+
<x-field data-name="authenticate" data-type="function" data-required="true" data-desc="Authenticates a user with email and password">
|
|
222
|
+
<x-field data-name="parameters" data-type="object" data-desc="Function parameters">
|
|
223
|
+
<x-field data-name="email" data-type="string" data-required="true" data-desc="User's email address"></x-field>
|
|
224
|
+
<x-field data-name="password" data-type="string" data-required="true" data-desc="User's password"></x-field>
|
|
225
|
+
<x-field data-name="rememberMe" data-type="boolean" data-required="false" data-default="false" data-desc="Whether to keep user logged in"></x-field>
|
|
226
|
+
</x-field>
|
|
227
|
+
<x-field data-name="returnValue" data-type="object" data-desc="Function return value">
|
|
228
|
+
<x-field data-name="success" data-type="boolean" data-required="true" data-desc="Whether authentication was successful"></x-field>
|
|
229
|
+
<x-field data-name="token" data-type="string" data-required="false" data-desc="JWT token if authentication successful"></x-field>
|
|
230
|
+
<x-field data-name="user" data-type="object" data-required="false" data-desc="User information if authentication successful">
|
|
231
|
+
<x-field data-name="id" data-type="string" data-required="true" data-desc="User ID"></x-field>
|
|
232
|
+
<x-field data-name="name" data-type="string" data-required="true" data-desc="User's display name"></x-field>
|
|
233
|
+
<x-field data-name="email" data-type="string" data-required="true" data-desc="User's email address"></x-field>
|
|
234
|
+
</x-field>
|
|
235
|
+
</x-field>
|
|
236
|
+
</x-field>
|
|
237
|
+
</x-field-group>
|
|
197
238
|
```
|
|
198
|
-
|
|
239
|
+
|
|
240
|
+
### Bad Examples
|
|
241
|
+
|
|
242
|
+
Example 1: Using self-closing tag (violates "Opening/Closing Tags Format" rule)
|
|
243
|
+
|
|
244
|
+
```md
|
|
245
|
+
<x-field-group>
|
|
246
|
+
<x-field data-name="user_id" data-type="string" data-required="true" data-desc="User identifier" />
|
|
247
|
+
</x-field-group>
|
|
199
248
|
```
|
|
200
249
|
|
|
201
|
-
Example
|
|
250
|
+
Example 2: Using both `data-desc` and `<x-field-desc>` (violates "Description Mutually Exclusive" rule)
|
|
202
251
|
|
|
252
|
+
```md
|
|
253
|
+
<x-field-group>
|
|
254
|
+
<x-field data-name="api_key" data-type="string" data-required="true" data-desc="API key for authentication">
|
|
255
|
+
<x-field-desc markdown>Your **API key** for authentication. Keep it secure and never expose it.</x-field-desc>
|
|
256
|
+
</x-field>
|
|
257
|
+
</x-field-group>
|
|
203
258
|
```
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
259
|
+
|
|
260
|
+
Example 3: Using multiple `<x-field-desc>` elements (violates "Single Description Rule")
|
|
261
|
+
|
|
262
|
+
```md
|
|
263
|
+
<x-field-group>
|
|
264
|
+
<x-field data-name="config" data-type="object" data-required="true">
|
|
265
|
+
<x-field-desc markdown>Configuration object for the application.</x-field-desc>
|
|
266
|
+
<x-field-desc markdown>Contains all runtime settings and preferences.</x-field-desc>
|
|
267
|
+
</x-field>
|
|
268
|
+
</x-field-group>
|
|
207
269
|
```
|
|
208
270
|
|
|
209
|
-
Example 4: Nesting other child elements
|
|
271
|
+
Example 4: Nesting other child elements (violates "Children" rule)
|
|
210
272
|
|
|
273
|
+
```md
|
|
274
|
+
<x-field-group>
|
|
275
|
+
<x-field data-name="user" data-type="object" data-required="true">
|
|
276
|
+
<div>User information</div>
|
|
277
|
+
<x-field data-name="name" data-type="string" data-required="true" data-desc="User name"></x-field>
|
|
278
|
+
</x-field>
|
|
279
|
+
</x-field-group>
|
|
211
280
|
```
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
281
|
+
|
|
282
|
+
Example 5: Missing x-field-group wrapper (violates "Grouping Requirement" rule)
|
|
283
|
+
|
|
284
|
+
```md
|
|
285
|
+
<x-field data-name="apiConfig" data-type="object" data-required="true" data-desc="API configuration object">
|
|
286
|
+
<x-field data-name="baseUrl" data-type="string" data-required="true" data-desc="Base URL for API calls"></x-field>
|
|
287
|
+
<x-field data-name="timeout" data-type="number" data-required="false" data-default="5000" data-desc="Request timeout in milliseconds"></x-field>
|
|
215
288
|
</x-field>
|
|
216
289
|
```
|
|
217
290
|
|
|
218
|
-
|
|
291
|
+
Example 6: Exceeding maximum nesting depth (violates "Maximum Nesting Depth" rule)
|
|
219
292
|
|
|
220
|
-
|
|
293
|
+
```md
|
|
294
|
+
<x-field-group>
|
|
295
|
+
<x-field data-name="level1" data-type="object" data-required="true">
|
|
296
|
+
<x-field data-name="level2" data-type="object" data-required="true">
|
|
297
|
+
<x-field data-name="level3" data-type="object" data-required="true">
|
|
298
|
+
<x-field data-name="level4" data-type="object" data-required="true">
|
|
299
|
+
<x-field data-name="level5" data-type="object" data-required="true">
|
|
300
|
+
<x-field data-name="level6" data-type="string" data-required="true" data-desc="Too deep nesting"></x-field>
|
|
301
|
+
</x-field>
|
|
302
|
+
</x-field>
|
|
303
|
+
</x-field>
|
|
304
|
+
</x-field>
|
|
305
|
+
</x-field>
|
|
306
|
+
</x-field-group>
|
|
307
|
+
```
|
|
221
308
|
|
|
222
|
-
|
|
309
|
+
## XFieldDesc Rich field description
|
|
223
310
|
|
|
224
|
-
|
|
311
|
+
Used to provide rich text descriptions for `<x-field>` elements, supporting inline markdown formatting for enhanced readability.
|
|
225
312
|
|
|
226
|
-
Attributes
|
|
313
|
+
### Attributes
|
|
227
314
|
|
|
228
315
|
- `markdown` (required): **MUST** be set to "markdown" . This attribute is mandatory and cannot be omitted
|
|
229
316
|
- **Validation**: `<x-field-desc>` without `markdown` attribute will be rejected
|
|
230
317
|
|
|
231
|
-
|
|
318
|
+
### Children
|
|
232
319
|
|
|
233
320
|
- Supports **bold text**, `inline code`, _italic text_, and other inline markdown
|
|
234
|
-
-
|
|
235
|
-
- **
|
|
321
|
+
- Description text must be provided as child content of `<x-field-desc>`, not as the value of the `markdown` attribute
|
|
322
|
+
- **Inline Markdown Only**: Allow only inline Markdown (e.g., `**bold**`, *italic*, `inline code`); block elements like code blocks, headings, lists, or tables are **not allowed**.
|
|
236
323
|
|
|
237
|
-
|
|
324
|
+
### Usage Rules
|
|
238
325
|
|
|
239
|
-
- Must be child of `<x-field>`: `<x-field-desc>` can only appear as a child element of `<x-field>` components
|
|
326
|
+
- **Parent Requirement**: Must be child of `<x-field>`: `<x-field-desc>` can only appear as a child element of `<x-field>` components
|
|
240
327
|
|
|
241
|
-
### Examples
|
|
328
|
+
### Good Examples
|
|
242
329
|
|
|
243
|
-
<field_desc_good_examples>
|
|
244
330
|
Example 1: Basic markdown description
|
|
245
331
|
|
|
246
|
-
```
|
|
332
|
+
```md
|
|
247
333
|
<x-field-desc markdown>Your **API key** for authentication. Generate one from the `Settings > API Keys` section. Keep it secure and never expose it in client-side code.</x-field-desc>
|
|
248
334
|
```
|
|
249
335
|
|
|
250
336
|
Example 2: Description with inline code
|
|
251
337
|
|
|
252
|
-
```
|
|
338
|
+
```md
|
|
253
339
|
<x-field-desc markdown>**JWT token** containing user identity and permissions. Expires in `24 hours` by default. Use the `refresh_token` to obtain a new one.</x-field-desc>
|
|
254
340
|
```
|
|
255
341
|
|
|
256
|
-
|
|
342
|
+
### Bad Examples
|
|
257
343
|
|
|
258
|
-
|
|
259
|
-
Example 1: Missing markdown attribute
|
|
344
|
+
Example 1: Missing markdown attribute (violates "markdown attribute required" rule)
|
|
260
345
|
|
|
261
|
-
```
|
|
346
|
+
```md
|
|
262
347
|
<x-field data-name="api_key" data-type="string" data-required="true">
|
|
263
348
|
<x-field-desc>Your **API key** for authentication.</x-field-desc>
|
|
264
349
|
</x-field>
|
|
265
350
|
```
|
|
266
351
|
|
|
267
|
-
Example 2: Incorrect markdown attribute usage
|
|
352
|
+
Example 2: Incorrect markdown attribute usage (violates "markdown attribute format" rule)
|
|
268
353
|
|
|
269
|
-
```
|
|
354
|
+
```md
|
|
270
355
|
<x-field data-name="api_key" data-type="string" data-required="true">
|
|
271
356
|
<x-field-desc markdown="Your **API key** for authentication."></x-field-desc>
|
|
272
357
|
</x-field>
|
|
273
358
|
```
|
|
274
359
|
|
|
275
|
-
Example 3: Using self-closing tag
|
|
360
|
+
Example 3: Using self-closing tag (violates "opening/closing tags format" rule)
|
|
276
361
|
|
|
277
|
-
```
|
|
362
|
+
```md
|
|
278
363
|
<x-field data-name="user_id" data-type="string" data-required="true">
|
|
279
364
|
<x-field-desc markdown />
|
|
280
365
|
</x-field>
|
|
281
366
|
```
|
|
282
367
|
|
|
283
|
-
Example 4: Containing block-level elements
|
|
368
|
+
Example 4: Containing block-level elements (violates "Inline Content Only" rule)
|
|
284
369
|
|
|
285
|
-
|
|
370
|
+
````md
|
|
286
371
|
<x-field data-name="config" data-type="object" data-required="true">
|
|
287
372
|
<x-field-desc markdown>
|
|
288
|
-
Configuration
|
|
289
|
-
|
|
290
|
-
|
|
373
|
+
**Configuration settings** for the application.
|
|
374
|
+
|
|
375
|
+
## Important Notes
|
|
291
376
|
- Set debug to true for development
|
|
292
377
|
- Use production database in production
|
|
293
|
-
|
|
294
|
-
|
|
378
|
+
|
|
379
|
+
```javascript
|
|
295
380
|
const config = { debug: true };
|
|
296
|
-
|
|
381
|
+
```
|
|
297
382
|
</x-field-desc>
|
|
298
383
|
</x-field>
|
|
299
|
-
|
|
384
|
+
````
|
|
300
385
|
|
|
301
|
-
Example 5: Used outside of x-field component
|
|
386
|
+
Example 5: Used outside of x-field component (violates "Parent Requirement" rule)
|
|
302
387
|
|
|
303
|
-
```
|
|
388
|
+
```md
|
|
304
389
|
<x-field-desc markdown>This description is not inside an x-field component.</x-field-desc>
|
|
305
390
|
```
|
|
306
391
|
|
|
307
|
-
Example 6: Used as child of other components
|
|
392
|
+
Example 6: Used as child of other components (violates "Parent Requirement" rule)
|
|
308
393
|
|
|
309
|
-
```
|
|
394
|
+
```md
|
|
310
395
|
<x-field-group>
|
|
311
396
|
<x-field data-name="name" data-type="string" data-required="true" data-desc="User name"></x-field>
|
|
312
397
|
<x-field-desc markdown>This description is not inside an x-field component.</x-field-desc>
|
|
313
398
|
</x-field-group>
|
|
314
399
|
```
|
|
315
400
|
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
## `<x-field-group>` Field Group Component
|
|
401
|
+
## XFieldGroup: Field grouping container
|
|
319
402
|
|
|
320
403
|
Used to group multiple related `<x-field>` elements at the top level, indicating they belong to the same object or context. This provides better organization and visual grouping for related parameters.
|
|
321
404
|
|
|
322
|
-
###
|
|
323
|
-
|
|
324
|
-
Attributes:
|
|
405
|
+
### Attributes
|
|
325
406
|
|
|
326
407
|
- No attributes required
|
|
327
408
|
|
|
328
|
-
|
|
409
|
+
### Children
|
|
329
410
|
|
|
330
411
|
- Only `<x-field>` elements are allowed as children
|
|
331
412
|
|
|
332
|
-
|
|
413
|
+
### Usage Rules
|
|
333
414
|
|
|
334
|
-
- Top-
|
|
335
|
-
-
|
|
415
|
+
- **Top-Level Only**: Used only at the top level for grouping related `<x-field>` elements. Cannot be nested inside other `<x-field>` or `<x-field-group>` elements
|
|
416
|
+
- **Structured Data Only**: Use `<x-field-group>` for fields **other than simple types** (`string`, `number`, `boolean`, `symbol`), e.g., Properties, Context, Parameters, Return values. For simple-type fields, use plain Markdown text.
|
|
336
417
|
|
|
337
|
-
### Examples
|
|
418
|
+
### Good Examples
|
|
338
419
|
|
|
339
|
-
<field_group_good_examples>
|
|
340
420
|
Example 1: Product information fields
|
|
341
421
|
|
|
342
|
-
```
|
|
422
|
+
```md
|
|
343
423
|
<x-field-group>
|
|
344
424
|
<x-field data-name="name" data-type="string" data-required="true" data-desc="The name of the product."></x-field>
|
|
345
425
|
<x-field data-name="description" data-type="string" data-required="false" data-desc="An optional description for the product."></x-field>
|
|
@@ -350,12 +430,11 @@ Example 1: Product information fields
|
|
|
350
430
|
</x-field-group>
|
|
351
431
|
```
|
|
352
432
|
|
|
353
|
-
|
|
433
|
+
### Bad Examples
|
|
354
434
|
|
|
355
|
-
|
|
356
|
-
Example 1: Nested inside x-field component
|
|
435
|
+
Example 1: Nested inside x-field component (violates "Top-Level Only" rule)
|
|
357
436
|
|
|
358
|
-
```
|
|
437
|
+
```md
|
|
359
438
|
<x-field data-name="user" data-type="object" data-required="true">
|
|
360
439
|
<x-field-group>
|
|
361
440
|
<x-field data-name="name" data-type="string" data-required="true" data-desc="User name"></x-field>
|
|
@@ -364,9 +443,9 @@ Example 1: Nested inside x-field component
|
|
|
364
443
|
</x-field>
|
|
365
444
|
```
|
|
366
445
|
|
|
367
|
-
Example 2: Nested inside another x-field-group
|
|
446
|
+
Example 2: Nested inside another x-field-group (violates "Top-Level Only" rule)
|
|
368
447
|
|
|
369
|
-
```
|
|
448
|
+
```md
|
|
370
449
|
<x-field-group>
|
|
371
450
|
<x-field data-name="user" data-type="object" data-required="true" data-desc="User information"></x-field>
|
|
372
451
|
<x-field-group>
|
|
@@ -376,9 +455,9 @@ Example 2: Nested inside another x-field-group
|
|
|
376
455
|
</x-field-group>
|
|
377
456
|
```
|
|
378
457
|
|
|
379
|
-
Example 3: Containing non-x-field elements
|
|
458
|
+
Example 3: Containing non-x-field elements (violates "Only x-field elements allowed" rule)
|
|
380
459
|
|
|
381
|
-
```
|
|
460
|
+
```md
|
|
382
461
|
<x-field-group>
|
|
383
462
|
<x-field data-name="name" data-type="string" data-required="true" data-desc="User name"></x-field>
|
|
384
463
|
<div>Additional information</div>
|
|
@@ -386,6 +465,21 @@ Example 3: Containing non-x-field elements
|
|
|
386
465
|
</x-field-group>
|
|
387
466
|
```
|
|
388
467
|
|
|
389
|
-
|
|
468
|
+
Example 4: Empty x-field-group (violates "Must contain x-field elements" rule)
|
|
469
|
+
|
|
470
|
+
```md
|
|
471
|
+
<x-field-group>
|
|
472
|
+
</x-field-group>
|
|
473
|
+
```
|
|
474
|
+
|
|
475
|
+
Example 5: Using x-field-group for simple-type (violates "Structured Data Only" rule)
|
|
476
|
+
|
|
477
|
+
```md
|
|
478
|
+
### appName
|
|
479
|
+
|
|
480
|
+
<x-field-group>
|
|
481
|
+
<x-field data-name="appName" data-type="string" data-required="true" data-desc="specifies the name of the application"></x-field>
|
|
482
|
+
</x-field-group>
|
|
483
|
+
```
|
|
390
484
|
|
|
391
|
-
</custom_components_usage>
|
|
485
|
+
</custom_components_usage>
|