---
title: 定制 Hugo 短代码
content_type: concept
---
本页面将介绍定制 Hugo 短代码,可以用于 Kubernetes markdown 文档书写。
关于短代码的更多信息可参见 [Hugo 文档](https://gohugo.io/content-management/shortcodes)。
## 功能状态
在本站的 markdown 页面中,你可以加入短代码来展示所描述的功能特性的版本和状态。
### 功能状态示例
下面是一个功能状态代码段的演示,表明这个功能已经在 Kubernetes v1.10 时就已经稳定了。
```
{{* feature-state for_k8s_version="v1.10" state="stable" */>}}
```
会转换为:
{{< feature-state for_k8s_version="v1.10" state="stable" >}}
`state` 的可选值如下:
* alpha
* beta
* deprecated
* stable
### 功能状态代码
所显示的 Kubernetes 默认为该页或站点版本。
可以通过修改 for_k8s_version 短代码参数来调整要显示的版本。
```
{{* feature-state for_k8s_version="v1.11" state="stable" */>}}
```
会转换为:
{{< feature-state for_k8s_version="v1.11" state="stable" >}}
#### Alpha 功能
```
{{* feature-state feature-state state="alpha" */>}}
```
会转换为:
{{< feature-state state="alpha" >}}
#### Beta 功能
```
{{* feature-state feature-state state="beta" */>}}
```
会转换为:
{{< feature-state state="beta" >}}
#### 稳定功能
```
{{* feature-state feature-state state="stable" */>}}
```
会转换为:
{{< feature-state state="stable" >}}
#### 废弃功能
```
{{* feature-state feature-state state="deprecated" */>}}
```
会转换为:
{{< feature-state state="deprecated" >}}
## 词汇
你可以通过加入术语词汇的短代码,来自动更新和替换相应链接中的内容
([我们的词汇库](/zh/docs/reference/glossary/))
这样,在浏览在线文档,鼠标移到术语上时,术语解释就会显示在提示框中。
词汇术语的原始数据保存在 [https://github.com/kubernetes/website/tree/master/content/en/docs/reference/glossary](https://github.com/kubernetes/website/tree/master/content/en/docs/reference/glossary),每个内容文件对应相应的术语解释。
### 词汇演示
例如,下面的代码在 markdown 中将会转换为 `{{< glossary_tooltip text="cluster" term_id="cluster" >}}`,
然后在提示框中显示。
```liquid
{{* glossary_tooltip text="cluster" term_id="cluster" */>}}
```
## 表格标题 {#table-captions}
通过添加表格标题,你可以让表格能够被屏幕阅读器读取。
要向表格添加[标题(Caption)](https://www.w3schools.com/tags/tag_caption.asp),
可用 `table` 短代码包围表格定义,并使用 `caption` 参数给出表格标题。
{{< note >}}
表格标题对屏幕阅读器是可见的,但在标准 HTML 中查看时是不可见的。
{{< /note >}}
下面是一个例子:
```go-html-template
{{* table caption="配置参数" >}}
参数 | 描述 | 默认值
:---------|:------------|:-------
`timeout` | 请求的超时时长 | `30s`
`logLevel` | 日志输出的级别 | `INFO`
{{< /table */>}}
```
所渲染的表格如下:
{{< table caption="配置参数" >}}
参数 | 描述 | 默认值
:---------|:------------|:-------
`timeout` | 请求的超时时长 | `30s`
`logLevel` | 日志输出的级别 | `INFO`
{{< /table >}}
如果你查看表格的 HTML 输出结果,你会看到 `