@aigne/doc-smith 0.8.14 → 0.8.15-beta
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 +12 -0
- package/agents/update/index.yaml +1 -1
- package/package.json +1 -1
- package/prompts/detail/custom/custom-components.md +247 -153
- package/prompts/detail/generate/detail-example.md +24 -8
- package/prompts/detail/generate/document-rules.md +4 -5
- package/prompts/translate/code-block.md +14 -7
- package/prompts/translate/translate-document.md +111 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.8.15-beta](https://github.com/AIGNE-io/aigne-doc-smith/compare/v0.8.14...v0.8.15-beta) (2025-10-21)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* update document publish prompt for better user experience ([#208](https://github.com/AIGNE-io/aigne-doc-smith/issues/208)) ([0726c23](https://github.com/AIGNE-io/aigne-doc-smith/commit/0726c23ed2d47b2126c0896d71922860b7436895))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* enforce stricter rules for x-field component and markdown ([#210](https://github.com/AIGNE-io/aigne-doc-smith/issues/210)) ([d69ee53](https://github.com/AIGNE-io/aigne-doc-smith/commit/d69ee53dbd113859a822d3391cc6cbf2f02bb75e))
|
|
14
|
+
|
|
3
15
|
## [0.8.14](https://github.com/AIGNE-io/aigne-doc-smith/compare/v0.8.14-beta.2...v0.8.14) (2025-10-19)
|
|
4
16
|
|
|
5
17
|
## [0.8.14-beta.2](https://github.com/AIGNE-io/aigne-doc-smith/compare/v0.8.14-beta.1...v0.8.14-beta.2) (2025-10-19)
|
package/agents/update/index.yaml
CHANGED
|
@@ -36,7 +36,7 @@ skills:
|
|
|
36
36
|
- ../update/save-and-translate-document.mjs
|
|
37
37
|
- url: ../utils/action-success.mjs
|
|
38
38
|
default_input:
|
|
39
|
-
action: "✅ Documents updated successfully"
|
|
39
|
+
action: "✅ Documents updated successfully!\n💡 Looks good? Run `aigne doc publish` to go live."
|
|
40
40
|
input_schema:
|
|
41
41
|
type: object
|
|
42
42
|
properties:
|
package/package.json
CHANGED
|
@@ -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>
|
|
@@ -80,7 +80,9 @@ Here are some high-quality documentation details for your reference:
|
|
|
80
80
|
|
|
81
81
|
**Returns**
|
|
82
82
|
|
|
83
|
-
<x-field
|
|
83
|
+
<x-field-group>
|
|
84
|
+
<x-field data-name="product" data-type="TProductExpanded" data-desc="The newly created product object, including expanded details"></x-field>
|
|
85
|
+
</x-field-group>
|
|
84
86
|
|
|
85
87
|
**Example**
|
|
86
88
|
|
|
@@ -130,11 +132,15 @@ Here are some high-quality documentation details for your reference:
|
|
|
130
132
|
|
|
131
133
|
**Parameters**
|
|
132
134
|
|
|
133
|
-
<x-field
|
|
135
|
+
<x-field-group>
|
|
136
|
+
<x-field data-name="id" data-type="string" data-required="true" data-desc="The unique identifier of the product to retrieve."></x-field>
|
|
137
|
+
</x-field-group>
|
|
134
138
|
|
|
135
139
|
**Returns**
|
|
136
140
|
|
|
137
|
-
<x-field
|
|
141
|
+
<x-field-group>
|
|
142
|
+
<x-field data-name="product" data-type="TProductExpanded" data-desc="The retrieved product object, including expanded details."></x-field>
|
|
143
|
+
</x-field-group>
|
|
138
144
|
|
|
139
145
|
**Example**
|
|
140
146
|
|
|
@@ -176,7 +182,9 @@ Here are some high-quality documentation details for your reference:
|
|
|
176
182
|
|
|
177
183
|
**Returns**
|
|
178
184
|
|
|
179
|
-
<x-field
|
|
185
|
+
<x-field-group>
|
|
186
|
+
<x-field data-name="product" data-type="TProductExpanded" data-desc="The updated product object."></x-field>
|
|
187
|
+
</x-field-group>
|
|
180
188
|
|
|
181
189
|
**Example**
|
|
182
190
|
|
|
@@ -341,11 +349,15 @@ Here are some high-quality documentation details for your reference:
|
|
|
341
349
|
|
|
342
350
|
**Parameters**
|
|
343
351
|
|
|
344
|
-
<x-field
|
|
352
|
+
<x-field-group>
|
|
353
|
+
<x-field data-name="id" data-type="string" data-required="true" data-desc="The unique identifier of the product to archive."></x-field>
|
|
354
|
+
</x-field-group>
|
|
345
355
|
|
|
346
356
|
**Returns**
|
|
347
357
|
|
|
348
|
-
<x-field
|
|
358
|
+
<x-field-group>
|
|
359
|
+
<x-field data-name="product" data-type="TProduct" data-desc="The archived product object."></x-field>
|
|
360
|
+
</x-field-group>
|
|
349
361
|
|
|
350
362
|
**Example**
|
|
351
363
|
|
|
@@ -380,11 +392,15 @@ Here are some high-quality documentation details for your reference:
|
|
|
380
392
|
|
|
381
393
|
**Parameters**
|
|
382
394
|
|
|
383
|
-
<x-field
|
|
395
|
+
<x-field-group>
|
|
396
|
+
<x-field data-name="id" data-type="string" data-required="true" data-desc="The unique identifier of the product to delete."></x-field>
|
|
397
|
+
</x-field-group>
|
|
384
398
|
|
|
385
399
|
**Returns**
|
|
386
400
|
|
|
387
|
-
<x-field
|
|
401
|
+
<x-field-group>
|
|
402
|
+
<x-field data-name="product" data-type="TProduct" data-desc="The deleted product object."></x-field>
|
|
403
|
+
</x-field-group>
|
|
388
404
|
|
|
389
405
|
**Example**
|
|
390
406
|
|
|
@@ -7,18 +7,17 @@ Documentation Generation Rules:
|
|
|
7
7
|
- Since API names are already specified in document titles, avoid repeating them in subheadings—use sub-API names directly
|
|
8
8
|
- Include links to related documents in the introduction using Markdown format to help users navigate to relevant content
|
|
9
9
|
- Add links to further reading materials in the summary section using Markdown format
|
|
10
|
+
- **Markdown Syntax Constraint**: Use only GitHub Flavored Markdown (GFM) syntax by default. Prohibited extensions include: custom blocks `:::`, footnotes `[^1]: notes`, math formulas `$$ LaTeX`, highlighted text `==code==`, and other non-GFM syntax unless explicitly defined in custom component rules
|
|
10
11
|
- Use proper Markdown link syntax, for example: [Next Chapter Title](next_chapter_path)
|
|
11
12
|
- **Ensure next_chapter_path references either external URLs or valid paths from the documentation structure**—use absolute paths from the documentation structure
|
|
12
13
|
- When DataSources includes third-party links, incorporate them appropriately throughout the document
|
|
13
14
|
- Structure each section with: title, introduction, code examples, response data samples, and explanatory notes. Place explanations directly after code examples without separate "Example Description" subheadings
|
|
14
15
|
- Maintain content completeness and logical flow so users can follow the documentation seamlessly
|
|
15
16
|
- Provide comprehensive explanations for configuration options and parameters. When parameters accept multiple values, explain each option's purpose and include code examples where applicable
|
|
16
|
-
- Use the `<x-field>` custom component only for displaying structured object data such as API parameters, return values, network request body/query/headers, and complex object properties (e.g., ContextType). This component does not exist independently but represents complete object structures
|
|
17
|
-
- Do not use `<x-field>` for individual field descriptions (e.g., name or version in package.json, logo or appUrl in config.yaml) - use regular Markdown text instead
|
|
18
|
-
- Wrap the outermost `<x-field>` elements with `<x-field-group>` when describing multiple properties of the same object, even if there's only one `<x-field>` element
|
|
19
|
-
- Use recursive `<x-field>` structures to fully express complex object type hierarchies, decomposing all nested properties into more fundamental types. Limit nesting to 5 levels maximum
|
|
20
17
|
- All interface and method documentation must include **response data examples**
|
|
21
|
-
-
|
|
18
|
+
- **Use `<x-field-group>` for all structured data**: Represent objects with nested `<x-field>` elements, and expand each structure to the **deepest relevant level**.
|
|
19
|
+
- **Enhance field descriptions with example values**: For structured data defined using `<x-field-group>`, extract example values from type definitions, comments, or test cases to make documentation more practical and user-friendly.
|
|
20
|
+
- **Use Markdown tables** for predefined values (e.g., status types, options) or term definitions to improve clarity and allow side-by-side comparison.
|
|
22
21
|
- Validate output Markdown for completeness, ensuring tables are properly formatted
|
|
23
22
|
- **Content Integrity**: Generate complete, syntactically correct code blocks (JSON, etc.). Perform self-validation to ensure all code blocks, lists, and tables are properly closed without truncation
|
|
24
23
|
- **Markdown Syntax Validation**: Ensure correct Markdown formatting, particularly table separators (e.g., `|---|---|---|`) that match column counts
|
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
<code_block_rules>
|
|
2
2
|
The following formats are considered Code Blocks:
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
|
|
4
|
+
- Wrapped with ```
|
|
5
|
+
- Supports configurations: language, title, icon, where title and icon are optional
|
|
6
|
+
- content can be code, command line examples, text or any other content
|
|
6
7
|
|
|
7
8
|
<code_block_sample>
|
|
9
|
+
|
|
8
10
|
```{language} [{title}] [icon={icon}]
|
|
9
11
|
{content}
|
|
10
12
|
```
|
|
13
|
+
|
|
11
14
|
</code_block_sample>
|
|
12
15
|
|
|
13
|
-
Code Block Translation:
|
|
14
|
-
|
|
15
|
-
- For
|
|
16
|
-
|
|
16
|
+
Code Block Translation Rules:
|
|
17
|
+
|
|
18
|
+
- For D2 code blocks, translate **labels only**; leave all variable names, component names, and syntax unchanged.
|
|
19
|
+
- Translate **comments only** using the language-specific comment syntax; **preserve** all code, variables, functions, and syntax.
|
|
20
|
+
- **Do not translate** command examples, terminal/log outputs, or runtime output.
|
|
21
|
+
- **Preserve** all formatting, indentation, and code block structure.
|
|
22
|
+
|
|
23
|
+
</code_block_rules>
|
|
@@ -9,6 +9,7 @@ Core Mandates:
|
|
|
9
9
|
3. Readability and Flow: The final output must be **smooth, logical, and highly readable**. Sentences must flow naturally, ensuring a pleasant and coherent reading experience for the target audience.
|
|
10
10
|
4. Localization and Clarity: Where a **literal (word-for-word) translation** of a term, phrase, or idiom would be **uncommon, confusing, or ambiguous** in the target language, you must apply **localization best practices**. This means translating the **concept** into the most **idiomatic, common, and easily understandable expression** in the target language.
|
|
11
11
|
5. Versatility and Scope: You are proficient in handling **any pair of requested languages** (e.g., Chinese $\leftrightarrow$ English, English $\leftrightarrow$ Japanese) and are adept at translating diverse **document types**, including but not limited to: **Technical Manuals, Business Reports, Marketing Copy/Ads, Legal Documents, Academic Papers, and General Correspondence.**
|
|
12
|
+
|
|
12
13
|
</role_and_goal>
|
|
13
14
|
|
|
14
15
|
<translation_rules>
|
|
@@ -19,11 +20,12 @@ Translation Requirements:
|
|
|
19
20
|
- Strictly Protect Markdown Syntax: All Markdown syntax characters, including but not limited to `|` and `-` in tables, `*` and `-` in lists, `#` in headings, `` ` `` in code blocks, etc., must be **copied exactly**, with no modification, addition, deletion, or merging. Table separators (e.g., `|---|---|---|`) must match the original column count and format exactly, with separator columns matching table data columns.
|
|
20
21
|
- Use Terminology Reference: Ensure accuracy and consistency of professional terminology.
|
|
21
22
|
- Preserve Terms: Retain specific terms in their original form, avoiding translation.
|
|
23
|
+
- Maintain tone consistency: use a neutral tone for developer/DevOps docs, a polite tone for end-user/client docs, and do not mix address styles (e.g., **"you"** vs **"您"**).
|
|
24
|
+
- Translate Descriptions Only in <x-field>: All `<x-field>` component attributes must maintain the original format. Only translate the description content within `data-desc` attribute or `<x-field-desc>` elements.
|
|
22
25
|
|
|
23
26
|
{% include "./code-block.md" %}
|
|
24
27
|
</translation_rules>
|
|
25
28
|
|
|
26
|
-
|
|
27
29
|
{% if feedback %}
|
|
28
30
|
<translation_user_feedback>
|
|
29
31
|
{{ feedback }}
|
|
@@ -41,10 +43,11 @@ Translation Requirements:
|
|
|
41
43
|
{{userPreferences}}
|
|
42
44
|
|
|
43
45
|
User preference guidelines:
|
|
46
|
+
|
|
44
47
|
- User preferences are derived from feedback provided in previous user interactions. When generating translations, consider user preferences to avoid repeating issues mentioned in user feedback
|
|
45
48
|
- User preferences carry less weight than current user feedback
|
|
46
|
-
</user_preferences>
|
|
47
|
-
{% endif %}
|
|
49
|
+
</user_preferences>
|
|
50
|
+
{% endif %}
|
|
48
51
|
|
|
49
52
|
{% include "./glossary.md" %}
|
|
50
53
|
|
|
@@ -58,7 +61,7 @@ Terms to preserve (do not translate):
|
|
|
58
61
|
|
|
59
62
|
<example>
|
|
60
63
|
<example_item>
|
|
61
|
-
|
|
64
|
+
Table Translation - Demonstrates how to translate table content while preserving markdown structure and separators.
|
|
62
65
|
|
|
63
66
|
<before_translate>
|
|
64
67
|
| Name | Type | Description |
|
|
@@ -77,7 +80,8 @@ Terms to preserve (do not translate):
|
|
|
77
80
|
</example_item>
|
|
78
81
|
|
|
79
82
|
<example_item>
|
|
80
|
-
|
|
83
|
+
XField Component Translation - Shows how to translate only description content within x-field components while preserving all attributes.
|
|
84
|
+
|
|
81
85
|
<before_translate>
|
|
82
86
|
|
|
83
87
|
<x-field data-name="teamDid" data-type="string" data-required="true" data-desc="The DID of the team or Blocklet managing the webhook."></x-field>
|
|
@@ -96,9 +100,10 @@ Terms to preserve (do not translate):
|
|
|
96
100
|
</example_item>
|
|
97
101
|
|
|
98
102
|
<example_item>
|
|
99
|
-
|
|
103
|
+
Code Block Translation - Illustrates translating only comments in code blocks while keeping all code content unchanged.
|
|
100
104
|
|
|
101
105
|
<before_translate>
|
|
106
|
+
|
|
102
107
|
```xxx
|
|
103
108
|
// Initialize the API client
|
|
104
109
|
const client = new APIClient({
|
|
@@ -125,9 +130,11 @@ async function getUserData(userId) {
|
|
|
125
130
|
}
|
|
126
131
|
}
|
|
127
132
|
```
|
|
133
|
+
|
|
128
134
|
</before_translate>
|
|
129
135
|
|
|
130
136
|
<after_translate>
|
|
137
|
+
|
|
131
138
|
```xxx
|
|
132
139
|
// 初始化 API 客户端
|
|
133
140
|
const client = new APIClient({
|
|
@@ -154,13 +161,15 @@ async function getUserData(userId) {
|
|
|
154
161
|
}
|
|
155
162
|
}
|
|
156
163
|
```
|
|
164
|
+
|
|
157
165
|
</after_translate>
|
|
158
166
|
</example_item>
|
|
159
167
|
|
|
160
168
|
<example_item>
|
|
161
|
-
|
|
169
|
+
Command and Log Preservation - Demonstrates preserving command execution and log output without translation.
|
|
162
170
|
|
|
163
171
|
<before_translate>
|
|
172
|
+
|
|
164
173
|
```text Timeout Error Message
|
|
165
174
|
Blocklet Server failed to stop within 5 minutes
|
|
166
175
|
You can stop blocklet server with blocklet stop --force
|
|
@@ -171,9 +180,11 @@ $ cli log
|
|
|
171
180
|
|
|
172
181
|
Cache for server cleared: [list of cleared cache keys]
|
|
173
182
|
```
|
|
183
|
+
|
|
174
184
|
</before_translate>
|
|
175
185
|
|
|
176
186
|
<after_translate>
|
|
187
|
+
|
|
177
188
|
```text 超时错误消息
|
|
178
189
|
Blocklet Server failed to stop within 5 minutes
|
|
179
190
|
You can stop blocklet server with blocklet stop --force
|
|
@@ -184,6 +195,99 @@ $ cli log
|
|
|
184
195
|
|
|
185
196
|
Cache for server cleared: [list of cleared cache keys]
|
|
186
197
|
```
|
|
198
|
+
|
|
199
|
+
</after_translate>
|
|
200
|
+
</example_item>
|
|
201
|
+
|
|
202
|
+
<example_item>
|
|
203
|
+
D2 Diagram Translation - Shows how to translate only labels in D2 diagrams while preserving all syntax and structure.
|
|
204
|
+
|
|
205
|
+
<before_translate>
|
|
206
|
+
|
|
207
|
+
```d2 High-Level Architecture
|
|
208
|
+
direction: down
|
|
209
|
+
|
|
210
|
+
User: {
|
|
211
|
+
shape: c4-person
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
Your-Application: {
|
|
215
|
+
label: "Your Application"
|
|
216
|
+
shape: rectangle
|
|
217
|
+
|
|
218
|
+
PaymentProvider: {
|
|
219
|
+
label: "PaymentProvider"
|
|
220
|
+
shape: rectangle
|
|
221
|
+
|
|
222
|
+
Payment-Components: {
|
|
223
|
+
label: "Payment Components"
|
|
224
|
+
shape: rectangle
|
|
225
|
+
grid-columns: 2
|
|
226
|
+
|
|
227
|
+
CheckoutForm: { label: "CheckoutForm" }
|
|
228
|
+
CheckoutTable: { label: "CheckoutTable" }
|
|
229
|
+
CheckoutDonate: { label: "CheckoutDonate" }
|
|
230
|
+
CustomerInvoiceList: { label: "CustomerInvoiceList" }
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
Payment-Kit-Backend: {
|
|
236
|
+
label: "Payment Kit Backend"
|
|
237
|
+
shape: cylinder
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
User -> Your-Application.PaymentProvider.Payment-Components: "Interacts with UI"
|
|
241
|
+
Your-Application.PaymentProvider -> Payment-Kit-Backend: "Handles API Communication"
|
|
242
|
+
Payment-Kit-Backend -> Your-Application.PaymentProvider: "Returns Data"
|
|
243
|
+
Your-Application.PaymentProvider.Payment-Components -> User: "Renders UI Updates"
|
|
244
|
+
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
</before_translate>
|
|
248
|
+
|
|
249
|
+
<after_translate>
|
|
250
|
+
|
|
251
|
+
```d2 高层架构
|
|
252
|
+
direction: down
|
|
253
|
+
|
|
254
|
+
User: {
|
|
255
|
+
shape: c4-person
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
Your-Application: {
|
|
259
|
+
label: "您的应用程序"
|
|
260
|
+
shape: rectangle
|
|
261
|
+
|
|
262
|
+
PaymentProvider: {
|
|
263
|
+
label: "PaymentProvider"
|
|
264
|
+
shape: rectangle
|
|
265
|
+
|
|
266
|
+
Payment-Components: {
|
|
267
|
+
label: "支付组件"
|
|
268
|
+
shape: rectangle
|
|
269
|
+
grid-columns: 2
|
|
270
|
+
|
|
271
|
+
CheckoutForm: { label: "CheckoutForm" }
|
|
272
|
+
CheckoutTable: { label: "CheckoutTable" }
|
|
273
|
+
CheckoutDonate: { label: "CheckoutDonate" }
|
|
274
|
+
CustomerInvoiceList: { label: "CustomerInvoiceList" }
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
Payment-Kit-Backend: {
|
|
280
|
+
label: "Payment Kit 后端"
|
|
281
|
+
shape: cylinder
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
User -> Your-Application.PaymentProvider.Payment-Components: "与 UI 交互"
|
|
285
|
+
Your-Application.PaymentProvider -> Payment-Kit-Backend: "处理 API 通信"
|
|
286
|
+
Payment-Kit-Backend -> Your-Application.PaymentProvider: "返回数据"
|
|
287
|
+
Your-Application.PaymentProvider.Payment-Components -> User: "渲染 UI 更新"
|
|
288
|
+
|
|
289
|
+
```
|
|
290
|
+
|
|
187
291
|
</after_translate>
|
|
188
292
|
</example_item>
|
|
189
293
|
|