# YAML語法原語

• 生產參數
• 縮進空間
• 分離空間
• 忽略的行前綴
• 摺疊線

## 1. 生產參數

Chomping

`Chomping`過程的一個例子如下所示 -

``````strip: |-
text↓
clip: |
text↓
keep: |+
text↓``````

## 2. 縮進空間

``````%YAML 1.1
---
!!map {
? !!str "Not indented"
: !!map {
? !!str "By one space"
: !!str "By four\n spaces\n",
? !!str "Flow style"
: !!seq [
!!str "By two",
!!str "Still by two",
!!str "Again by two",
]
}
}``````

``````{
"Not indented": {
"By one space": "By four\n spaces\n",
"Flow style": [
"By two",
"Still by two",
"Again by two"
]
}
}``````

## 3. 分離空間

YAML使用空格字符分隔標記。 最重要的注意事項是YAML中的分隔不應包含製表符。

``{ · first: · Sammy, · last: · Sosa · }``

``````{
"\u00b7 last": "\u00b7 Sosa \u00b7",
"\u00b7 first": "\u00b7 Sammy"
}``````

## 4. 忽略行前綴

``````%YAML 1.1
---
!!map {
? !!str "plain"
: !!str "text lines",
? !!str "quoted"
: !!str "text lines",
? !!str "block"
: !!str "text·®lines\n"
}``````

``````{
"plain": "text lines",
"quoted": "text lines",
"block": "text\u00b7\u00aelines\n"
}``````

## 5. 摺疊線

``````%YAML 1.1
--- !!str
"specific\L\
trimmed\n\n\n\
as space"``````

``"specific\u2028trimmed\n\n\nas space"``