开发者

Markdown within yaml / yaml multi-line escape sequence?

开发者 https://www.devze.com 2023-01-11 23:36 出处:网络
Is it possible to store unescaped markdown documents in yaml? I\'ve tested key:|+ markdown text block that could have any combination of line breaks, >, -, :, \', \" etc et开发者_开发百科c.

Is it possible to store unescaped markdown documents in yaml? I've tested

key:|+ 
    markdown text block that could have any combination of line breaks, >, -, :, ', " etc et开发者_开发百科c. 

This does not work. I need something like CDATA or python style triple-quotes for yamal. Any ideas?


In literal style of scalar type (what you used in example) line brakes needs still to be "escaped" (in this case intended correctly).

And you can only have printable characters.

I am not fammiliar with markdown, but in case you would need to save unprintable characters, you would definitelly to escape them.

From Yaml specification:

To ensure readability, YAML streams use only the printable subset of the Unicode character set. The allowed character range explicitly excludes the C0 control block #x0-#x1F (except for TAB #x9, LF #xA, and CR #xD which are allowed), DEL #x7F, the C1 control block #x80-#x9F (except for NEL #x85 which is allowed), the surrogate block #xD800-#xDFFF, #xFFFE, and #xFFFF.

On input, a YAML processor must accept all Unicode characters except those explicitly excluded above.

On output, a YAML processor must only produce acceptable characters. Any excluded characters must be presented using escape sequences.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号