You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -45,7 +45,7 @@ Then initialize a configuration file `doom.config.yml`:
45
45
title: My Docs
46
46
```
47
47
48
-
Also, create a `tsconfig.json` file with the following content:
48
+
Also create a `tsconfig.json` file with the following content:
49
49
50
50
```jsonc
51
51
{
@@ -66,15 +66,15 @@ Also, create a `tsconfig.json` file with the following content:
66
66
}
67
67
```
68
68
69
-
Lastly, create a `global.d.ts` file with the following content:
69
+
Finally, create a `global.d.ts` file with the following content:
70
70
71
71
```ts
72
72
/// <reference types="@alauda/doom/runtime" />
73
73
```
74
74
75
-
Now you can use the global components provided by doom in your `.mdx` files with type safety.
75
+
This allows you to safely use the global components provided by doom in `.mdx` files with type safety.
76
76
77
-
## Command Line Tool \{#cli}
77
+
## CLI Tool \{#cli}
78
78
79
79
```bash
80
80
doom -h
@@ -117,9 +117,11 @@ Commands:
117
117
help [command] display help for command
118
118
```
119
119
120
-
### Start Development Service \{#dev}
120
+
For more configuration, please refer to [Configuration](./usage/configuration)
121
121
122
-
Run `yarn dev` to start the development service, and the browser will automatically open the documentation homepage.
122
+
### Starting the Development Server \{#dev}
123
+
124
+
Run `yarn dev` to start the development server, the browser will automatically open the documentation homepage.
123
125
124
126
```sh
125
127
doom dev -h
@@ -135,23 +137,23 @@ Arguments:
135
137
Options:
136
138
-H, --host [host] Dev server host name
137
139
-P, --port [port] Dev server port number
138
-
-l, --lazy [boolean] Whether to enable `lazyCompilation`, which could improve the compilation performance (default: false)
140
+
-l, --lazy [boolean] Whether to enable `lazyCompilation` which could improve the compilation performance (default: false)
139
141
-h, --help display help for command
140
142
```
141
143
142
144
### Production Build \{#build}
143
145
144
-
Run `yarn build` to build the production environment code. After the build is completed, static files will be generated in the `dist` directory.
146
+
Run `yarn build` to build the production code. After building, static files will be generated in the `dist` directory.
145
147
146
148
### Local Preview \{#serve}
147
149
148
-
Run `yarn serve` to preview the built static files. Note that if you used the `-b`, `-p`options to build, the same options are also required when previewing.
150
+
Run `yarn serve` to preview the built static files. Note that if you used `-b` or `-p`parameters during build, you need to use the same `-b` and `-p` parameters during preview.
149
151
150
-
### Use Scaffolding Templates \{#new}
152
+
### Using Scaffolding Templates \{#new}
151
153
152
154
Run `yarn new` to generate projects, modules, or documentation using scaffolding templates.
153
155
154
-
### Translate Documentation \{#translate}
156
+
### Translating Documentation \{#translate}
155
157
156
158
```bash
157
159
doom translate -h
@@ -172,43 +174,43 @@ Options:
172
174
-h, --help display helpforcommand
173
175
```
174
176
175
-
- The `-g, --glob` parameter is required and can specify the directory or path of files to be translated, supporting `glob` syntax. Note that the parameter value must be quoted; otherwise, command line parsing may cause unexpected behavior. Examples:
176
-
177
-
1.`yarn translate -g abc xyz` will translate all documents in the `<root>/<source>/abc` and `<root>/<source>/xyz` directories to `<root>/<target>/abc` and `<root>/<target>/xyz`.
178
-
2.`yarn translate -g '*'` will translate all document files under `<root>/<source>`.
179
-
180
-
- The `-C, --copy` parameter is optional, determining whether to copy local resource files to the target directory when a target file does not exist. The default is `false`, which means changing the reference path of the resource file to the source path. Examples:
177
+
- The `-g, --glob` parameter is required. You can specify the directories or paths of files to translate, supporting `glob` syntax. Note that the parameter value must be quoted to avoid unexpected behavior from command line parsing. Examples:
178
+
1.`yarn translate -g abc xyz` will translate all documents under `<root>/<source>/abc` and `<root>/<source>/xyz` to `<root>/<target>/abc` and `<root>/<target>/xyz` respectively.
179
+
2.`yarn translate -g '*'` will translate all documents under `<root>/<source>`.
180
+
- The `-C, --copy` parameter is optional. It controls whether to copy local asset files to the target directory when the target file does not exist. The default is `false`, which means changing the asset reference path to the source path. Examples:
181
181
- When this parameter is enabled:
182
-
1.Translating `/<source>/abc.jpg` will copy `<root>/public/<source>/abc.jpg` to `<root>/public/<target>/abc.jpg` and change the document's reference path to `/<target>/abc.jpg`.
183
-
2. In `<root>/<source>/abc.mdx`, when translating the reference `./assets/xyz.jpg`, it will copy `<root>/<source>/assets/xyz.jpg` to `<root>/<target>/assets/xyz.jpg`, keeping the image reference path unchanged.
184
-
3. In `<root>/<source>/abc.mdx`, when translating the reference `./assets/<source>/xyz.jpg`, it will copy `<root>/<source>/assets/<source>/xyz.jpg` to `<root>/<target>/assets/<target>/xyz.jpg` and change the document's reference path to `./assets/<target>/xyz.jpg`.
185
-
-If this parameter is not enabled:
186
-
1.Translating `/<source>/abc.jpg`, if `<root>/public/<target>/abc.jpg`already exists, will change the document's reference path to `/<target>/abc.jpg`; otherwise, it will keep the image reference path unchanged.
187
-
2. In `<root>/<source>/abc.mdx`, when translating the reference `./assets/<source>/xyz.jpg`, if `<root>/<target>/assets/<target>/xyz.jpg`already exists, it will change the document's reference path to `./assets/<target>/xyz.jpg`; otherwise, it will change to `../<source>/assets/<target>/xyz.jpg`.
182
+
1.When translating `/<source>/abc.jpg`, `<root>/public/<source>/abc.jpg`will be copied to `<root>/public/<target>/abc.jpg`, and the reference path in the document will be changed to `/<target>/abc.jpg`.
183
+
2. In `<root>/<source>/abc.mdx`, the `./assets/xyz.jpg` reference will copy `<root>/<source>/assets/xyz.jpg` to `<root>/<target>/assets/xyz.jpg`, and the image reference path remains unchanged.
184
+
3. In `<root>/<source>/abc.mdx`, the `./assets/<source>/xyz.jpg` reference will copy `<root>/<source>/assets/<source>/xyz.jpg` to `<root>/<target>/assets/<target>/xyz.jpg`, and the reference path in the document will be changed to `./assets/<target>/xyz.jpg`.
185
+
-When this parameter is not enabled:
186
+
1.When translating `/<source>/abc.jpg`, if `<root>/public/<target>/abc.jpg` exists, the reference path in the document will be changed to `/<target>/abc.jpg`; otherwise, the image reference path remains unchanged.
187
+
2. In `<root>/<source>/abc.mdx`, if `<root>/<target>/assets/<target>/xyz.jpg` exists, the reference path `./assets/<source>/xyz.jpg` will be changed to `./assets/<target>/xyz.jpg`; otherwise, it will be changed to `../<source>/assets/<target>/xyz.jpg`.
188
188
189
189
:::warning
190
-
In particular, when using `-g '*'` for full translation, the file lists of the `source` and `target` directories will be compared. Any unmatched `target` files, excluding `internalRoutes`, will be automatically deleted.
190
+
Specifically, if you use `-g '*'` for full translation, the file lists of the `source` and `target` directories will be compared, and unmatched `target` files except for `internalRoutes` will be automatically deleted.
191
191
:::
192
192
193
193
:::tip
194
-
The translation function requires the local environment variable `AZURE_OPENAI_API_KEY` to be configured. Please contact your team leader for this information.
194
+
The translation feature requires the local environment variable `AZURE_OPENAI_API_KEY` to be configured. Please contact your team leader to obtain it.
195
195
:::
196
196
197
-
Metadata can be used in the document to control translation behavior:
197
+
You can control translation behavior in the document metadata:
198
198
199
199
```yaml
200
200
i18n:
201
201
title:
202
202
en: DevOps Connectors
203
-
additionalPrompts: 'In this text, Connectors is a proper noun, do not translate it.'
203
+
additionalPrompts: 'The Connectors in this document are proper nouns and should not be translated'
204
204
disableAutoTranslation: false
205
-
title: DevOps 连接器
205
+
title: DevOps Connectors
206
206
```
207
207
208
-
### Export PDF \{#export}
208
+
For more configuration, please refer to [Translation Configuration](./usage/configuration#translate)
209
+
210
+
### Exporting PDF \{#export}
209
211
210
212
:::warning
211
-
Please run the `yarn build` operation before executing the export operation.
213
+
Please run the `yarn build` command before exporting.
212
214
:::
213
215
214
216
```sh
@@ -228,10 +230,29 @@ Options:
228
230
-h, --help display help for command
229
231
```
230
232
231
-
Run `yarn export` to export the documentation as a PDF file. Note that if you used `-b`, `-p`options to build, the same options are also required during export.
233
+
Run `yarn export` to export the documentation as PDF files. Note that if you used `-b` or `-p`parameters during build, you need to use the same `-b` and `-p` parameters during export.
232
234
233
-
The export functionality relies on [`playwright`](https://playwright.dev). In the pipeline, please use `build-harbor.alauda.cn/frontend/playwright-runner:doom` as the base image for dependency installation and documentation building. You can set the following environment variable locally to speed up downloads:
235
+
The export feature depends on [`playwright`](https://playwright.dev). For CI pipelines, please use `build-harbor.alauda.cn/frontend/playwright-runner:doom` as the base image for dependency installation and documentation building. Locally, you can set the following environment variable to speed up downloads:
0 commit comments