docs: translate code height limit (#290)

This commit is contained in:
翊小久 2023-11-07 20:01:50 +08:00 committed by GitHub
parent 1c89e25228
commit 1d630d6727
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 42 additions and 20 deletions

View File

@ -7,9 +7,13 @@ categories:
codeHeightLimit: 300
---
## Configure for single page
::: zh-CN
在 Front Matter 中设置 `codeHeightLimit: 300`
:::
You can configure it in frontmatter. For example:
::: en
Set `codeHeightLimit: 300` in Front Matter.
:::
```md
---
@ -17,7 +21,13 @@ codeHeightLimit: 300
---
```
This is a code block that exceeds the height limit.
::: zh-CN
渲染结果
:::
::: en
Rendering result
:::
```ts
import { defineValaxyConfig } from 'valaxy'
@ -50,18 +60,3 @@ export default defineValaxyConfig<ThemeConfig>({
},
})
```
## Configure for the entire website
Add `codeHeightLimit` field in `site.config.ts`.
For example:
```ts
import { defineSiteConfig } from 'valaxy'
export default defineSiteConfig({
// ignore other configuration
codeHeightLimit: 300
})
```

View File

@ -410,22 +410,42 @@ export default defineSiteConfig({
})
```
### 代码块高度限制
### 代码块高度限制 {lang="zh-CN"}
### Code Height Limit {lang="en"}
::: zh-CN
你可以为每篇文章设置代码块高度限制。
:::
::: en
You can set the height limit for each article.
:::
::: zh-CN
譬如设置 `codeHeightLimit: 300`,则文章中所有代码块高度都不会超过 300px并自动折叠。
:::
::: en
For example, if you set `codeHeightLimit: 300`, the height of all code blocks in the article will not exceed 300px and will be automatically collapsed.
:::
```ts {5}
import { defineSiteConfig } from 'valaxy'
export default defineSiteConfig({
// ...
codeHeightLimit: 300
codeHeightLimit: 300,
})
```
::: zh-CN
你也可以在文章的 Front Matter 中单独设置:
:::
::: en
You can also set it separately in the Front Matter of the article:
:::
```md {2}
---
@ -433,7 +453,14 @@ codeHeightLimit: 300
---
```
::: zh-CN
示例可参见 [代码块高度限制](/examples/code-height-limit)。
:::
::: en
Example can refer to [Code Height Limit](/examples/code-height-limit).
:::
### 内容加密 {lang="zh-CN"}