1. Block Notation(plain, flow-style, scalar): Newlines become spaces and extra newlines after the block are removed
---# Note: It has 1 new line after the stringcontent: Arbitrary free text over multiple lines stopping after indentation changes......
Equivalent JSON
{"content": "Arbitrary free text over multiple lines stopping after indentation changes..."}
2. Literal Block Scalar: A Literal Block Scalar | will include the newlines and any trailing spaces. but removes extra
newlines after the block.
---# After string we have 2 spaces and 2 new linescontent1: | Arbitrary free text over "multiple lines" stopping after indentation changes... ...
Equivalent JSON
{"content1": "Arbitrary free text\nover \"multiple lines\" stopping\nafter indentation changes... \n"}
3. + indicator with Literal Block Scalar: keep extra newlines after block
---# After string we have 2 new linesplain: |+ This unquoted scalar spans many lines....
Equivalent JSON
{"plain": "This unquoted scalar\nspans many lines.\n\n\n"}
4. – indicator with Literal Block Scalar:– means that the newline at the end of the string is removed.
---# After string we have 2 new linesplain: |- This unquoted scalar spans many lines....
Equivalent JSON
{"plain": "This unquoted scalar\nspans many lines."}
5. Folded Block Scalar(>):
will fold newlines to spaces and but removes extra newlines after the block.
---folded_newlines: > this is really a single line of text despite appearances...
Equivalent JSON
{"fold_newlines": "this is really a single line of text despite appearances\n"}
for more you can visit my Blog