docs(zh): sync translations (#3493)

* sync with a1fb363a8b

* sync with 9510cd70c1

* sync with c882fa1469

* sync with ba3c6441be

* sync with ac87d19ca1
pull/3500/head
Xavi Lee 5 months ago committed by GitHub
parent d01a0a5c66
commit 3b860f9e8c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -263,6 +263,42 @@ Wraps in a <div class="vp-raw">
})
```
## GitHub 风格的警报 {#github-flavored-alerts}
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)的渲染方式相同。
```md
> [!NOTE]
> Highlights information that users should take into account, even when skimming.
> [!TIP]
> Optional information to help a user be more successful.
> [!IMPORTANT]
> Crucial information necessary for users to succeed.
> [!WARNING]
> Critical content demanding immediate user attention due to potential risks.
> [!CAUTION]
> Negative potential consequences of an action.
```
> [!NOTE]
> Highlights information that users should take into account, even when skimming.
> [!TIP]
> Optional information to help a user be more successful.
> [!IMPORTANT]
> Crucial information necessary for users to succeed.
> [!WARNING]
> Critical content demanding immediate user attention due to potential risks.
> [!CAUTION]
> Negative potential consequences of an action.
## 代码块中的语法高亮 {#syntax-highlighting-in-code-blocks}
VitePress 使用 [Shikiji](https://github.com/antfu/shikiji) ([Shiki](https://shiki.matsu.io/) 的改进版本) 在 Markdown 代码块中使用彩色文本实现语法高亮。Shiki 支持多种编程语言。需要做的就是将有效的语言别名附加到代码块的开头:

@ -129,9 +129,9 @@ src/getting-started.md --> /getting-started.html
默认情况下VitePress 将入站链接解析为以 `.html` 结尾的 URL。但是一些用户可能更喜欢没有 .html 扩展名的“简洁 URL”——例如`example.com/path` 而不是 `example.com/path.html`
某些服务器或托管平台 (例如 Netlify 或 Vercel) 提供将 `/foo` 之类的 URL 映射到 `/foo.html` (如果存在) 的功能,而无需重定向:
某些服务器或托管平台 (例如 Netlify、Vercel 或 GitHub Pages) 提供将 `/foo` 之类的 URL 映射到 `/foo.html` (如果存在) 的功能,而无需重定向:
- Netlify 默认支持。
- Netlify 和 GitHub Pages 是默认支持
- Vercel 需要在 [vercel.json 中启用 cleanUrls 选项](https://vercel.com/docs/concepts/projects/project-configuration#cleanurls)。
如果可以使用此功能,还可以启用 VitePress 自己的 [`cleanUrls`](../reference/site-config#cleanurls) 配置选项,以便:
@ -139,7 +139,7 @@ src/getting-started.md --> /getting-started.html
- 页面之间的入站链接是在没有 `.html` 扩展名的情况下生成的。
- 如果当前路径以 `.html` 结尾,路由器将执行客户端重定向到无扩展路径。
但是,如果无法为服务器配置此类支持 (例如 GitHub Pages),则必须手动采用以下目录结构:
但是,如果无法为服务器配置此类支持,则必须手动采用以下目录结构:
```
.

@ -244,6 +244,7 @@ type SocialLinkIcon =
| 'instagram'
| 'linkedin'
| 'mastodon'
| 'npm'
| 'slack'
| 'twitter'
| 'x'

@ -645,6 +645,24 @@ export default {
}
```
#### 示例:添加 canonical URL `<link>` {#example-adding-a-canonical-url-link}
```ts
export default {
transformPageData(pageData) {
const canonicalUrl = `https://example.com/${pageData.relativePath}`
.replace(/index\.md$/, '')
.replace(/\.md$/, '.html')
pageData.frontmatter.head ??= []
pageData.frontmatter.head.push([
'link',
{ rel: 'canonical', href: canonicalUrl }
])
}
}
```
### transformHtml
- 类型:`(code: string, id: string, context: TransformContext) => Awaitable<string | void>`

Loading…
Cancel
Save