Skip to content

Commit 3b860f9

Browse files
docs(zh): sync translations (#3493)
* sync with a1fb363 * sync with 9510cd7 * sync with c882fa1 * sync with ba3c644 * sync with ac87d19
1 parent d01a0a5 commit 3b860f9

File tree

4 files changed

+58
-3
lines changed

4 files changed

+58
-3
lines changed

docs/zh/guide/markdown.md

+36
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,42 @@ Wraps in a <div class="vp-raw">
263263
})
264264
```
265265

266+
## GitHub 风格的警报 {#github-flavored-alerts}
267+
268+
VitePress 同样支持以标注的方式渲染 [GitHub 风格的警报](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts)。它们和[自定义容器](#custom-containers)的渲染方式相同。
269+
270+
```md
271+
> [!NOTE]
272+
> Highlights information that users should take into account, even when skimming.
273+
274+
> [!TIP]
275+
> Optional information to help a user be more successful.
276+
277+
> [!IMPORTANT]
278+
> Crucial information necessary for users to succeed.
279+
280+
> [!WARNING]
281+
> Critical content demanding immediate user attention due to potential risks.
282+
283+
> [!CAUTION]
284+
> Negative potential consequences of an action.
285+
```
286+
287+
> [!NOTE]
288+
> Highlights information that users should take into account, even when skimming.
289+
290+
> [!TIP]
291+
> Optional information to help a user be more successful.
292+
293+
> [!IMPORTANT]
294+
> Crucial information necessary for users to succeed.
295+
296+
> [!WARNING]
297+
> Critical content demanding immediate user attention due to potential risks.
298+
299+
> [!CAUTION]
300+
> Negative potential consequences of an action.
301+
266302
## 代码块中的语法高亮 {#syntax-highlighting-in-code-blocks}
267303

268304
VitePress 使用 [Shikiji](https://github.com/antfu/shikiji) ([Shiki](https://shiki.matsu.io/) 的改进版本) 在 Markdown 代码块中使用彩色文本实现语法高亮。Shiki 支持多种编程语言。需要做的就是将有效的语言别名附加到代码块的开头:

docs/zh/guide/routing.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -129,17 +129,17 @@ src/getting-started.md --> /getting-started.html
129129

130130
默认情况下,VitePress 将入站链接解析为以 `.html` 结尾的 URL。但是,一些用户可能更喜欢没有 .html 扩展名的“简洁 URL”——例如,`example.com/path` 而不是 `example.com/path.html`
131131

132-
某些服务器或托管平台 (例如 Netlify 或 Vercel) 提供将 `/foo` 之类的 URL 映射到 `/foo.html` (如果存在) 的功能,而无需重定向:
132+
某些服务器或托管平台 (例如 Netlify、VercelGitHub Pages) 提供将 `/foo` 之类的 URL 映射到 `/foo.html` (如果存在) 的功能,而无需重定向:
133133

134-
- Netlify 默认支持
134+
- Netlify 和 GitHub Pages 是默认支持的
135135
- Vercel 需要在 [vercel.json 中启用 cleanUrls 选项](https://vercel.com/docs/concepts/projects/project-configuration#cleanurls)
136136

137137
如果可以使用此功能,还可以启用 VitePress 自己的 [`cleanUrls`](../reference/site-config#cleanurls) 配置选项,以便:
138138

139139
- 页面之间的入站链接是在没有 `.html` 扩展名的情况下生成的。
140140
- 如果当前路径以 `.html` 结尾,路由器将执行客户端重定向到无扩展路径。
141141

142-
但是,如果无法为服务器配置此类支持 (例如 GitHub Pages),则必须手动采用以下目录结构:
142+
但是,如果无法为服务器配置此类支持,则必须手动采用以下目录结构:
143143

144144
```
145145
.

docs/zh/reference/default-theme-config.md

+1
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ type SocialLinkIcon =
244244
| 'instagram'
245245
| 'linkedin'
246246
| 'mastodon'
247+
| 'npm'
247248
| 'slack'
248249
| 'twitter'
249250
| 'x'

docs/zh/reference/site-config.md

+18
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,24 @@ export default {
645645
}
646646
```
647647

648+
#### 示例:添加 canonical URL `<link>` {#example-adding-a-canonical-url-link}
649+
650+
```ts
651+
export default {
652+
transformPageData(pageData) {
653+
const canonicalUrl = `https://example.com/${pageData.relativePath}`
654+
.replace(/index\.md$/, '')
655+
.replace(/\.md$/, '.html')
656+
657+
pageData.frontmatter.head ??= []
658+
pageData.frontmatter.head.push([
659+
'link',
660+
{ rel: 'canonical', href: canonicalUrl }
661+
])
662+
}
663+
}
664+
```
665+
648666
### transformHtml
649667

650668
- 类型:`(code: string, id: string, context: TransformContext) => Awaitable<string | void>`

0 commit comments

Comments
 (0)