Skip to content

Commit ba4b05f

Browse files
authored
fix: unescape unexpected symbols in sidebar (#98)
1 parent 45fcdf5 commit ba4b05f

File tree

28 files changed

+303
-71
lines changed

28 files changed

+303
-71
lines changed

.changeset/stupid-sloths-relax.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@alauda/doom": patch
3+
---
4+
5+
fix: unescape unexpected symbols in sidebar

docs/en/start.mdx

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
sourceSHA: b7fe69a866c3e8893f7eddf6720d3366865e8e03b58658225bdd926ad71d6c87
2+
sourceSHA: e8aa2b84d58ff17ca57bc7aa4aa8c4479944ae37b389df87676d487ab1ababe9
33
---
44

55
# Getting Started \{#start}
@@ -45,7 +45,7 @@ Then initialize a configuration file `doom.config.yml`:
4545
title: My Docs
4646
```
4747
48-
Also create a `tsconfig.json` file with the following content:
48+
Also create `tsconfig.json` with the following content:
4949

5050
```jsonc
5151
{
@@ -72,7 +72,7 @@ Finally, create a `global.d.ts` file with the following content:
7272
/// <reference types="@alauda/doom/runtime" />
7373
```
7474

75-
This allows you to safely use the global components provided by doom with type safety in `.mdx` files.
75+
This allows you to safely use the global components provided by doom in `.mdx` files with type safety.
7676

7777
## CLI Tool \{#cli}
7878

@@ -121,7 +121,7 @@ For more configuration, please refer to [Configuration](./usage/configuration)
121121
122122
### Starting the Development Server \{#dev}
123123
124-
Run `yarn dev` to start the development server, the browser will automatically open the documentation homepage.
124+
Run `yarn dev` to start the development server; the browser will automatically open the documentation homepage.
125125

126126
```sh
127127
doom dev -h
@@ -148,11 +148,11 @@ Run `yarn build` to build the production code. After building, static files will
148148

149149
### Local Preview \{#serve}
150150

151-
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.
151+
Run `yarn serve` to preview the built static files. Note that if you used `-b`, `-p` parameters during build, you need to use the same `-b`, `-p` parameters during preview.
152152

153153
### Using Scaffolding Templates \{#new}
154154

155-
Run `yarn new` to generate projects, modules, or documentation using scaffolding templates.
155+
Run `yarn new` to generate projects, modules, or documentation from scaffolding templates.
156156

157157
### Translating Documentation \{#translate}
158158

@@ -175,24 +175,24 @@ Options:
175175
-h, --help display help for command
176176
```
177177

178-
- The `-g, --glob` parameter is required and 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 caused by command line parsing. Examples:
178+
- The `-g, --glob` parameter is required and specifies the directories or files to translate, supporting `glob` syntax. Note that the parameter value must be quoted to avoid unexpected behavior from the shell. Examples:
179179
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.
180-
2. `yarn translate -g '*'` will translate all document files under `<root>/<source>`.
181-
- The `-C, --copy` parameter is optional. It determines 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:
182-
- When this parameter is enabled:
183-
1. When translating `/<source>/abc.jpg`, it will copy `<root>/public/<source>/abc.jpg` to `<root>/public/<target>/abc.jpg` and modify the reference path in the document to `/<target>/abc.jpg`.
184-
2. For `<root>/<source>/abc.mdx` documents referencing `./assets/xyz.jpg`, it will copy `<root>/<source>/assets/xyz.jpg` to `<root>/<target>/assets/xyz.jpg`, and the image reference path remains unchanged.
185-
3. For `<root>/<source>/abc.mdx` documents referencing `./assets/<source>/xyz.jpg`, it will copy `<root>/<source>/assets/<source>/xyz.jpg` to `<root>/<target>/assets/<target>/xyz.jpg` and modify the reference path in the document to `./assets/<target>/xyz.jpg`.
186-
- When this parameter is not enabled:
187-
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.
188-
2. For `<root>/<source>/abc.mdx` documents referencing `./assets/<source>/xyz.jpg`, if `<root>/<target>/assets/<target>/xyz.jpg` exists, the reference path will be changed to `./assets/<target>/xyz.jpg`; otherwise, it will be changed to `../<source>/assets/<target>/xyz.jpg`.
180+
2. `yarn translate -g '*'` will translate all documents under `<root>/<source>`.
181+
- The `-C, --copy` parameter is optional and controls whether to copy local asset files to the target directory when the target file does not exist. The default is `false`, which changes the asset reference paths to the source paths. Examples:
182+
- When enabled:
183+
1. `/<source>/abc.jpg` will copy `<root>/public/<source>/abc.jpg` to `<root>/public/<target>/abc.jpg` and update the document reference path to `/<target>/abc.jpg`.
184+
2. In `<root>/<source>/abc.mdx`, a reference to `./assets/xyz.jpg` will copy `<root>/<source>/assets/xyz.jpg` to `<root>/<target>/assets/xyz.jpg`, keeping the image reference path unchanged.
185+
3. In `<root>/<source>/abc.mdx`, a reference to `./assets/<source>/xyz.jpg` will copy `<root>/<source>/assets/<source>/xyz.jpg` to `<root>/<target>/assets/<target>/xyz.jpg` and update the document reference path to `./assets/<target>/xyz.jpg`.
186+
- When not enabled:
187+
1. For `/<source>/abc.jpg`, if `<root>/public/<target>/abc.jpg` exists, the document reference path will be updated to `/<target>/abc.jpg`; otherwise, the image reference path remains unchanged.
188+
2. In `<root>/<source>/abc.mdx`, if `<root>/<target>/assets/<target>/xyz.jpg` exists, the reference path will be updated to `./assets/<target>/xyz.jpg`; otherwise, it will be changed to `../<source>/assets/<target>/xyz.jpg`.
189189

190190
:::warning
191191
Specifically, if you use `-g '*'` for full translation, the file lists of `source` and `target` directories will be compared, and unmatched `target` files except for `internalRoutes` will be automatically deleted.
192192
:::
193193

194194
:::tip
195-
The translation feature requires configuring the `AZURE_OPENAI_API_KEY` environment variable locally. Please contact your team leader to obtain it.
195+
The translation feature requires the local environment variable `AZURE_OPENAI_API_KEY` to be configured. Please contact your team leader to obtain it.
196196
:::
197197

198198
You can control translation behavior in the document metadata:
@@ -201,7 +201,7 @@ You can control translation behavior in the document metadata:
201201
i18n:
202202
title:
203203
en: DevOps Connectors
204-
additionalPrompts: 'The Connectors in this document are proper nouns and should not be translated'
204+
additionalPrompts: 'The term Connectors in this document is a proper noun and should not be translated'
205205
disableAutoTranslation: false
206206
title: DevOps Connectors
207207
```
@@ -211,7 +211,7 @@ For more configuration, please refer to [Translation Configuration](./usage/conf
211211
### Exporting PDF \{#export}
212212
213213
:::warning
214-
Please run `yarn build` before executing the export operation.
214+
Please run `yarn build` before performing the export operation.
215215
:::
216216

217217
```sh
@@ -231,9 +231,9 @@ Options:
231231
-h, --help display help for command
232232
```
233233

234-
Run `yarn export` to export the documentation as a PDF file. Note that if you used `-b` or `-p` parameters during build, you need to use the same `-b` and `-p` parameters during export.
234+
Run `yarn export` to export the documentation as PDF files. Note that if you used `-b`, `-p` parameters during build, you need to use the same `-b`, `-p` parameters during export.
235235

236-
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 build. Locally, you can set the following environment variable to speed up downloads:
236+
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:
237237

238238
```dotenv title=".env.yarn"
239239
PLAYWRIGHT_DOWNLOAD_HOST="https://cdn.npmmirror.com/binaries/playwright"
@@ -263,7 +263,7 @@ Options:
263263
```js
264264
import doom from '@alauda/doom/eslint'
265265

266-
export default await doom(new URL('docs', import.meta.url))
266+
export default doom(new URL('docs', import.meta.url))
267267
```
268268
269269
- `cspell.config.mjs`:
@@ -272,7 +272,7 @@ Options:
272272
export { default } from '@alauda/doom/cspell'
273273
```
274274
275-
We also agree that the `.cspell` folder in the current working directory (`CWD`) is used to store CSpell dictionary files. For example, you can create `.cspell/k8s.txt`:
275+
We also agree that the `.cspell` folder under the current working directory (`CWD`) is used to store CSpell dictionary files. For example, you can create `.cspell/k8s.txt`:
276276
277277
```txt
278278
k8s

docs/zh/start.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ Options:
261261
```js
262262
import doom from '@alauda/doom/eslint'
263263

264-
export default await doom(new URL('docs', import.meta.url))
264+
export default doom(new URL('docs', import.meta.url))
265265
```
266266
267267
- `cspell.config.mjs`:

eslint.config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import react from '@eslint-react/eslint-plugin'
55
import { createTypeScriptImportResolver } from 'eslint-import-resolver-typescript'
66
import { importX } from 'eslint-plugin-import-x'
77
import * as reactHooks from 'eslint-plugin-react-hooks'
8+
import * as regexp from 'eslint-plugin-regexp'
89
import { config, configs } from 'typescript-eslint'
910

1011
import doom from '@alauda/doom/eslint'
@@ -19,6 +20,7 @@ export default config(
1920
importX.flatConfigs.typescript,
2021
react.configs.recommended,
2122
reactHooks.configs['recommended-latest'],
23+
regexp.configs['flat/recommended'],
2224
{
2325
files: ['**/*.{ts,tsx}'],
2426
extends: [

fixture-docs/en/apis/kubernetes_apis/openshiftpipelinesascodes.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
weight: 180
33
---
44

5-
# OpenShiftPipelinesAsCode \[operator.tekton.dev/v1alpha1]
5+
# OpenShiftPipelinesAsCode \[operator.tekton.dev/v1alpha1\]
66

77
<K8sCrd name="openshiftpipelinesascodes.operator.tekton.dev" />

fixture-docs/en/index.mdx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
---
2-
---
3-
41
import { useI18n } from '@rspress/core/runtime'
52

6-
# {useI18n()('prod_intro')}
3+
# {useI18n()('prod_intro')} \{#prod_intro_i18n\}
74

85
<Term name="company" /> <Term name="product" /> <Term name="productShort" />
96

fixture-docs/en/test-escape.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Test \[Escape\] \{#prod_intro_i18n\}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
weight: 180
3-
sourceSHA: 80529755e86835c2c5f99b347fcc632b324a0b842601501c12298a32885a57d0
3+
sourceSHA: 8733482a1d5451a90df6860b2d69dbf076c039f6ee3ca5654aa8416f8c4d7bf6
44
---
55

6-
# OpenShiftPipelinesAsCode \[operator.tekton.dev/v1alpha1]
6+
# OpenShiftPipelinesAsCode \[operator.tekton.dev/v1alpha1\]
77

88
<K8sCrd name="openshiftpipelinesascodes.operator.tekton.dev" />

fixture-docs/ru/code-title.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
sourceSHA: e431f3377becf3888988f83837a2b714c8e0a3330d6aa1cd69611b93a22ba61a
3+
---
4+
5+
```js title="Hello World"
6+
console.log('Hello, World!')
7+
```

fixture-docs/ru/index.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
---
2-
sourceSHA: e752331d6b37e30a460ac29cb4eb13f753c324f2f938af8cf631cb446b280819
2+
sourceSHA: 7f15c9e90978c98f9621efe840a5f243bd12b7c53b495af9b5a0c03fdd349e91
33
---
44

55
import { useI18n } from '@rspress/core/runtime'
66

7-
# {useI18n()('prod_intro')}
7+
# {useI18n()('prod_intro')} \{#prod_intro_i18n}
88

99
<Term name="company" />
1010

1111
<Term name="product" />
1212

1313
<Term name="productShort" />
1414

15-
Следующие спецификации должны быть соблюдены в процессе перевода для интернационализации:
15+
Следующие требования должны соблюдаться в процессе перевода для интернационализации:
1616

17-
- Структура директорий многоязычных документов (`doc/en`) должна быть идентична документам в директории `doc/zh`, что обеспечит точное совпадение ссылок на многоязычные документы за исключением идентификатора языка.
17+
- Структура каталогов многоязычных документов (`doc/en`) должна быть идентична структуре документов в каталоге `doc/zh`, обеспечивая, что ссылки на многоязычные документы будут точно такими же, за исключением идентификатора языка.
1818

1919
::: danger
20-
Если для перевода используется инструмент автоматического перевода, нет необходимости беспокоиться об этом вопросе, так как инструмент автоматического перевода автоматически сгенерирует структуру директорий для документов целевого языка на основе `doc/zh`.
20+
Если для перевода используется автоматический инструмент перевода, беспокоиться об этом не нужно, так как автоматический инструмент перевода автоматически создаст структуру каталогов для документов целевого языка на основе `doc/zh`.
2121
:::
2222

2323
<Tabs>

0 commit comments

Comments
 (0)