

 **帮助改进此页面** 

要帮助改进本用户指南，请选择位于每个页面右侧窗格中的**在 GitHub 上编辑此页面**链接。

# AsciiDoc 语法参考
AsciiDoc 语法

AsciiDoc 是 Amazon 文档的首选标记语言。虽然该工具部分支持 Markdown 语法（例如标题和列表），但我们建议对所有内容都使用 AsciiDoc 语法，以确保一致性和正确呈现。

本指南涵盖您在为 Amazon EKS 文档撰稿时所需的常用语法元素。有关更高级的语法和详细信息，请参阅 [AsciiDoc 文档](https://docs.asciidoctor.org/asciidoc/latest/)。

## 新页面


每个新的 AsciiDoc 文档都应以[创建新页面](create-page.md)中定义的结构开头。

## 标题


使用标题按层次组织内容：

```
= Page/topic title (level 1)
== Section title (level 2)
=== Level 3 heading
==== Level 4 heading
===== Level 5 heading
====== Level 6 heading
```

注意：Amazon 文档中的标题始终使用句子大小写。

## 文本格式设置


设置文本格式以强调重要信息：

```
Use *bold text* for UI labels.
Use _italic text_ for introducing terms or light emphasis.
Use `monospace text` for code, file names, and commands.
```

## Lists


### 未排序的列表


为没有特定顺序的项目创建项目符号列表：

```
* First item
* Second item
** Nested item
** Another nested item
* Third item
```

### 排序后的列表


为顺序步骤或优先级项目创建编号列表：

```
. First step
. Second step
.. Substep 1
.. Substep 2
. Third step
```

## 链接


有关如何正确设置链接格式的详细信息，请参阅[插入链接](insert-link.md)。不支持 Markdown 样式的链接。

## 代码示例


### 内联代码


使用反引号表示内联代码：

```
Use the `kubectl get pods` command to list all pods.
```

### 代码块


创建具有语法突出显示并支持属性的代码块（类似于实体）：

```
 [source,python,subs="verbatim,attributes"]
 ----
 def hello_world():
     print("Hello, World!")
 ----
```

## 映像


插入带有替代文本的图像以实现可访问性：

```
image::images/image-file.png[Alt text description]
```

## 表


创建表格来整理信息：

```
[%header,cols="2"]
|===
|Header 1
|Header 2

|Cell 1,1
|Cell 1,2

|Cell 2,1
|Cell 2,2
|===
```

有关更复杂的表格，请参阅 [AsciiDoc 表格文档](https://docs.asciidoctor.org/asciidoc/latest/tables/build-a-basic-table/)。

## 标注


使用标注突出显示重要信息和警示内容：

```
NOTE: This is a note callout for general information.

TIP: This is a tip callout for helpful advice.

IMPORTANT: This is an important callout for critical information.
```

预览：

**注意**  
这是一个注释标注。

## 包含其他文件


包含来自其他文件的内容：

```
 include::filename.adoc[]
```

## 属性（类似于实体）


使用预定义属性来保持一致性。特别是，必须使用 Amazon 和 ` arn:aws-cn: ` 的属性。

```
{aws} provides Amazon EKS as a managed Kubernetes service.
```

```
 [source,bash,subs="verbatim,attributes"]
 ----
 aws iam attach-role-policy \
     --role-name AmazonEKSAutoClusterRole \
     --policy-arn {arn-aws}iam::aws:policy/AmazonEKSClusterPolicy
 ----
```

如需属性列表，请在 `../attributes.txt` 文件中查看。

## 过程


格式化分步过程：

```
To create an Amaozon EKS cluster. do the following steps.

. Sign in to the {aws} Management Console.
. Open the Amazon EKS console.
. Choose *Create cluster*.

...
```