@@ -30,12 +30,8 @@ they can also be unquoted:
30
30
31
31
A string in YAML
32
32
33
- .. code-block :: yaml
34
-
35
33
' A singled-quoted string in YAML'
36
34
37
- .. code-block :: yaml
38
-
39
35
" A double-quoted string in YAML"
40
36
41
37
Quoted styles are useful when a string starts or ends with one or more
@@ -45,9 +41,32 @@ their contents.
45
41
When using single-quoted strings, any single quote ``' `` inside its contents
46
42
must be doubled to escape it:
47
43
48
- .. code-block :: yaml
44
+ .. code-block :: yaml
49
45
50
- ' A single quote '' inside a single-quoted string'
46
+ ' A single quote '' inside a single-quoted string'
47
+
48
+ If the string contains any of the following characters, it must be escaped with
49
+ single quotes:
50
+
51
+ * ``: ``
52
+ * ``{ ``
53
+ * ``} ``
54
+ * ``[ ``
55
+ * ``] ``
56
+ * ``, ``
57
+ * ``& ``
58
+ * ``* ``
59
+ * ``# ``
60
+ * ``? ``
61
+ * ``| ``
62
+ * ``- ``
63
+ * ``< ``
64
+ * ``> ``
65
+ * ``= ``
66
+ * ``! ``
67
+ * ``% ``
68
+ * ``@ ``
69
+ * ``\` ``
51
70
52
71
The double-quoted style provides a way to express arbitrary strings, by
53
72
using ``\ `` escape sequences. It is very useful when you need to embed a
@@ -57,27 +76,46 @@ using ``\`` escape sequences. It is very useful when you need to embed a
57
76
58
77
" A double-quoted string in YAML\n "
59
78
60
- If the string contains any of the following characters, it must be escaped with
61
- single quotes:
62
-
63
- ===== ===== ===== ===== =====
64
- ``: `` ``{ `` ``} `` ``[ `` ``] ``
65
- ``, `` ``& `` ``* `` ``# `` ``? ``
66
- ``| `` ``- `` ``< `` ``> `` ``= ``
67
- ``! `` ``% `` ``@ `` ``\` ``
68
- ===== ===== ===== ===== =====
69
-
70
79
If the string contains any of the following control characters, it must be
71
80
escaped with double quotes. In addition, the escaping must use a double slash
72
81
``\\ `` to avoid parsing issues:
73
82
74
- ======== ======== ======== ======== ======== ======== ======== ========
75
- ``\0 `` ``\x01 `` ``\x02 `` ``\x03 `` ``\x04 `` ``\x05 `` ``\x06 `` ``\a ``
76
- ``\b `` ``\t `` ``\n `` ``\v `` ``\f `` ``\r `` ``\x0e `` ``\x0f ``
77
- ``\x10 `` ``\x11 `` ``\x12 `` ``\x13 `` ``\x14 `` ``\x15 `` ``\x16 `` ``\x17 ``
78
- ``\x18 `` ``\x19 `` ``\x1a `` ``\e `` ``\x1c `` ``\x1d `` ``\x1e `` ``\x1f ``
79
- ``\N `` ``\_ `` ``\L `` ``\P ``
80
- ======== ======== ======== ======== ======== ======== ======== ========
83
+ * ``\0 ``
84
+ * ``\x01 ``
85
+ * ``\x02 ``
86
+ * ``\x03 ``
87
+ * ``\x04 ``
88
+ * ``\x05 ``
89
+ * ``\x06 ``
90
+ * ``\a ``
91
+ * ``\b ``
92
+ * ``\t ``
93
+ * ``\n ``
94
+ * ``\v ``
95
+ * ``\f ``
96
+ * ``\r ``
97
+ * ``\x0e ``
98
+ * ``\x0f ``
99
+ * ``\x10 ``
100
+ * ``\x11 ``
101
+ * ``\x12 ``
102
+ * ``\x13 ``
103
+ * ``\x14 ``
104
+ * ``\x15 ``
105
+ * ``\x16 ``
106
+ * ``\x17 ``
107
+ * ``\x18 ``
108
+ * ``\x19 ``
109
+ * ``\x1a ``
110
+ * ``\e ``
111
+ * ``\x1c ``
112
+ * ``\x1d ``
113
+ * ``\x1e ``
114
+ * ``\x1f ``
115
+ * ``\N ``
116
+ * ``\_ ``
117
+ * ``\L ``
118
+ * ``\P ``
81
119
82
120
When a string contains line breaks, you can use the literal style, indicated
83
121
by the pipe (``| ``), to indicate that the string will span several lines. In
0 commit comments