【问题标题】:How to create line breaks in the description file in RAML?如何在 RAML 的描述文件中创建换行符?
【发布时间】:2017-01-22 13:04:14
【问题描述】:

我在 RAML 中有一个需要很长描述的字段。有没有办法把它分成多行?

例子:

"description": "这是一个很长的字符串"

我希望它呈现为:

"description": "这是
很长的字符串。”

谢谢

【问题讨论】:

    标签: field raml


    【解决方案1】:
    ...  
      description:
        1st line<br>
        2nd line<br>
        3rd line<br> 
    

    ...  
      description: 1st line<br>2nd line<br>3rd line<br>
    

    如下:
    raw raml
    produced html

    【讨论】:

    • 如果&lt;br&gt; 不起作用,请尝试在其前面添加一个空格。示例:foobar &lt;br&gt; 而不是 foobar&lt;br&gt;
    【解决方案2】:

    您可以使用| 将长线分成多个部分:-

     post:
        description: |
          Creates a new account. Some **bold** text here. More text. Need to fill the line, so make it longer still. Hooray!
          Line two Starts here
    

    参考:-https://github.com/raml2html/raml2html/blob/master/examples/example.raml

    另一种选择是使用!\n 来换行:-

      post:
            description: !
              "Creates a new account. Some **bold** text here. More text. Need to fill the line, so make it longer still. Hooray!\n
              Line two Starts here"     
    

    请注意这里的描述应该在""双引号下

    【讨论】:

    • 感谢 Anirban,但我说的是模式中一个字段的描述。
    • 在您的问题中,您明确提到:-“我在 RAML 中有一个需要很长描述的字段。
    • 是的,对不起,我的错。我对此很陌生,所以我提出的问题可能不清楚。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-11-17
    • 1970-01-01
    • 2013-05-26
    • 2012-03-27
    • 2010-10-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多