Markdown within yaml / yaml multi-line escape sequence?

半腔热情 提交于 2019-12-10 13:25:37

问题


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 etc. 

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


回答1:


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.



来源:https://stackoverflow.com/questions/3517968/markdown-within-yaml-yaml-multi-line-escape-sequence

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!