diff --git a/content/zh/docs/contribute/advanced.md b/content/zh/docs/contribute/advanced.md index 5fe6df4098..ccbbd6b3a0 100644 --- a/content/zh/docs/contribute/advanced.md +++ b/content/zh/docs/contribute/advanced.md @@ -1,5 +1,5 @@ --- -title: 高级贡献 +title: 进阶贡献 slug: advanced content_type: concept weight: 98 diff --git a/content/zh/docs/contribute/style/hugo-shortcodes/index.md b/content/zh/docs/contribute/style/hugo-shortcodes/index.md index 02d3dfc015..ef853710f0 100644 --- a/content/zh/docs/contribute/style/hugo-shortcodes/index.md +++ b/content/zh/docs/contribute/style/hugo-shortcodes/index.md @@ -9,10 +9,14 @@ content_type: concept - + 本页面将介绍 Hugo 自定义短代码,可以用于 Kubernetes Markdown 文档书写。 - + 关于短代码的更多信息可参见 [Hugo 文档](https://gohugo.io/content-management/shortcodes)。 @@ -20,18 +24,18 @@ content_type: concept ## 功能状态 -在本站的 Markdown 页面中,你可以加入短代码来展示所描述的功能特性的版本和状态。 +在本站的 Markdown 页面(`.md` 文件)中,你可以加入短代码来展示所描述的功能特性的版本和状态。 ### 功能状态示例 @@ -41,12 +45,16 @@ in the latest Kubernetes version. {{* feature-state state="stable" */>}} ``` - + 会转换为: {{< feature-state state="stable" >}} - + `state` 的可选值如下: * alpha @@ -69,7 +77,9 @@ feature state version by passing the `for_k8s_version` shortcode parameter. For {{* feature-state for_k8s_version="v1.10" state="beta" */>}} ``` - + 会转换为: {{< feature-state for_k8s_version="v1.10" state="beta" >}} @@ -78,10 +88,10 @@ feature state version by passing the `for_k8s_version` shortcode parameter. For ## Glossary There are two glossary shortcodes: `glossary_tooltip` and `glossary_definition`. -You can reference glossary terms with an inclusion that will automatically -update and replace content with the relevant links from [our -glossary](/docs/reference/glossary/). When the glossary term is moused-over, -the glossary entry displays a tooltip. The glossary term also displays as a link. +You can reference glossary terms with an inclusion that automatically updates +and replaces content with the relevant links from [our glossary](/docs/reference/glossary/). +When the glossary term is moused-over, the glossary entry displays a tooltip. +The glossary term also displays as a link. As well as inclusions with tooltips, you can reuse the definitions from the glossary in page content. @@ -96,21 +106,24 @@ page content. 除了包含工具提示外,你还可以重用页面内容中词汇表中的定义。 -词汇术语的原始数据保存在 [https://github.com/kubernetes/website/tree/main/content/en/docs/reference/glossary](https://github.com/kubernetes/website/tree/main/content/en/docs/reference/glossary),每个内容文件对应相应的术语解释。 +词汇术语的原始数据保存在[词汇目录](https://github.com/kubernetes/website/tree/main/content/en/docs/reference/glossary), +每个内容文件对应相应的术语解释。 ### 词汇演示 -例如,下面的代码在 Markdown 中将会转换为 `{{< glossary_tooltip text="cluster" term_id="cluster" >}}`, -然后在提示框中显示。 +例如下面的代码在 Markdown 中将会转换为 +{{< glossary_tooltip text="cluster" term_id="cluster" >}},然后在提示框中显示。 ``` {{* glossary_tooltip text="cluster" term_id="cluster" */>}} @@ -146,10 +159,68 @@ which renders as: 呈现为: {{< glossary_definition term_id="cluster" length="all" >}} + +## 链接至 API 参考 {#links-to-api-reference} + + +你可以使用 `api-reference` 短代码链接到 Kubernetes API 参考页面,例如 +Pod +{{< api-reference page="workload-resources/pod-v1" >}} 参考文件: + +``` +{{* api-reference page="workload-resources/pod-v1" */>}} +``` + + +本语句中 `page` 参数的内容是 API 参考页面的 URL 后缀。 + + + +你可以通过指定 `anchor` 参数链接到页面中的特定位置,例如到 +{{< api-reference page="workload-resources/pod-v1" anchor="PodSpec" >}} 参考,或页面的 +{{< api-reference page="workload-resources/pod-v1" anchor="environment-variables" >}} +部分。 + +``` +{{* api-reference page="workload-resources/pod-v1" anchor="PodSpec" */>}} +{{* api-reference page="workload-resources/pod-v1" anchor="environment-variables" */>}} +``` + + + +你可以通过指定 `text` 参数来更改链接的文本,例如通过链接到页面的 +{{< api-reference page="workload-resources/pod-v1" anchor="environment-variables" text="环境变量">}} +部分: + +``` +{{* api-reference page="workload-resources/pod-v1" anchor="environment-variables" text="环境变量" */>}} +``` + + * `name`: 标签页上显示的名字。 * `codelang`: 如果要在 `tab` 短代码中加入内部内容,需要告知 Hugo 使用的是什么代码语言,方便代码高亮。 @@ -245,10 +326,12 @@ The `tabs` shortcode takes these parameters: Hugo 会在包内查找文件(可以是 Hugo 所支持的任何 MIME 类型文件)。 否则,Hugo 会在当前路径的相对路径下查找所要包含的内容页面。 注意,在 `include` 页面中不能包含短代码内容,必须要使用自结束(self-closing)语法。 - 非内容文件将会被代码高亮。 + 例如 `{{* tab name="Content File #1" include="example1" /*/>}}`。 如果没有在 `codelang` 进行声明的话,Hugo 会根据文件名推测所用的语言。 + 默认情况下,非内容文件将会被代码高亮。 * 如果内部内容是 Markdown,你必须要使用 `%` 分隔符来包装标签页。 @@ -282,7 +365,9 @@ println "This is tab 2." {{< /tabs */>}} ``` - + 会转换为: {{< tabs name="tab_with_code" >}} @@ -294,41 +379,51 @@ println "This is tab 2." {{< /tab >}} {{< /tabs >}} - + ### 标签页演示:内联 Markdown 和 HTML ```go-html-template {{* tabs name="tab_with_md" >}} {{% tab name="Markdown" %}} -这是 **一些 markdown 。** -{{< note >}}它甚至可以包含短代码。{{< /note >}} +这是 **一些 markdown。** +{{< note >}} +它甚至可以包含短代码。 +{{< /note >}} {{% /tab %}} {{< tab name="HTML" >}}
这是一些 纯 HTML 。
+这是一些 纯 HTML。
这是一些 纯 HTML 。
+这是一些 纯 HTML。