你如何阻止yaml中的评论? [英] How do you do block comment in yaml?
问题描述
有人知道如何评论yaml中的一行代码行吗?
YAML支持内联注释,块评论。
从维基百科 :
注意以数字符号开头(
#
), en.wikipedia.org/wiki/YAML#Comparison_with_JSONrel =nofollow noreferrer>维基百科:
语法差异在实践中很少出现:JSON允许扩展字符集,如UTF-32,YAML需要一个空格,如逗号,等于和冒号之后的分隔符,而JSON不是,一些非标准的JSON实现扩展语法包括Javascript的
/ * ... * /
注释。处理这种边缘情况可能需要在解析之前对JSON进行轻微的预处理,然后作为内联YAML解析。
#如果你想写
#一个块注释的Haiku
#你需要三磅符号
Does anyone know how to comment a block of lines in yaml?
解决方案YAML supports inline comments, but does not support block comments.
From Wikipedia:
Comments begin with the number sign (
#
), can start anywhere on a line, and continue until the end of the lineA comparison with JSON, also from Wikipedia:
The syntax differences are subtle and seldom arise in practice: JSON allows extended charactersets like UTF-32, YAML requires a space after separators like comma, equals, and colon while JSON does not, and some non-standard implementations of JSON extend the grammar to include Javascript's
/* ... */
comments. Handling such edge cases may require light pre-processing of the JSON before parsing as in-line YAML.
# If you want to write # a block-commented Haiku # you'll need three pound signs
这篇关于你如何阻止yaml中的评论?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!