【问题标题】:Dangling message-body asset error悬空消息体资产错误
【发布时间】:2015-04-02 09:14:39
【问题描述】:

我正在尝试使用 apiblueprint 来记录 API,但我遇到了一个错误(在第 31 行),上面写着“悬空的消息体资产,需要一个预先格式化的代码块,将它的每一行缩进 8 个空格或 2 个标签”。我只是在添加目录后才开始看到此错误。

如果我删除第 (34) 行“”,那么错误就消失了。可能是我在这里遗漏了一些东西,或者我可能不清楚。对它的任何帮助都是可观的。谢谢

以下是我的示例降价。

FORMAT: 1A
---


## [I. Introduction](#def-intro)
1. [Group 1](#def-g1)
    1. [G1 Resource 1](#def-g1-res1)
    2. [G1 Resource 2](#def-g1-res2)
2. [Group 2](#def-g2)
    1. [G2 Resource 1](#def-g2-res1)
    2. [G2 Resource 2](#def-g2-res2)
---

<a name="def-intro"> </a>
# I. Introduction
This is my test API

<a name="def-g1"> </a>
# 1. Group 1
This is group 1 API

<a name="def-g1-res1"> </a>
## 1. G1 Resource 1 [/g1api1]
### g1api1 [GET]
This is g1api1

+ Response 200 (application/json)

        {
            "response": "ok",
            "resource": "g1api1"
        }

<a name="def-g1-res1"> </a>
## 2. G1 Resource 2 [/g1api2]
This is g1api2
### g1api2 [GET]


+ Response 200 (application/json)

        {
        "response": "ok",
        "resource": "g1api2"
        }

【问题讨论】:

    标签: apiblueprint


    【解决方案1】:

    您的一个问题是使用锚点,尤其是之前的问题:

    2。 G1 资源 2 [/g1api2]

    您不需要这样做。如果您在没有这些锚点的情况下呈现文档并查看左侧列,则可以单击那里的链接。您会注意到浏览器地址栏中的相关片段。然后,您可以在降价链接中使用这些片段,例如:

    FORMAT: 1A
    
    # My Api
    This is my test API
    
    ## Table of Contents
    1. [Introduction Section](#introduction/introduction-section)
    1. [Group 1](#reference/one)
    
        1. [G1 Resource 1](#reference/one/resource-1)
        2. [G1 Resource 2](#reference/one/resource-2)
    
    ## Introduction Section
    Blah Blah
    
    
    # Group One
    This is group 1 API
    
    ## Resource 1 [/g1api1]
    ### g1api1 [GET]
    This is g1api1
    
    + Response 200 (application/json)
    
            {
                "response": "ok",
                "resource": "g1api1"
            }
    
    ## Resource 2 [/g1api2]
    This is g1api2
    ### g1api2 [GET]
    
    
    + Response 200 (application/json)
    
            {
            "response": "ok",
            "resource": "g1api2"
            }
    

    另外,它会帮助你阅读:https://apiary.io/blueprint

    您不应该将数字放在“组”和“资源”关键字之前,因为它们在定义这些部分时必须放在首位。 Apiary 将在左栏中为您呈现快捷方式,正如我上面所说,您可以按照我上面的示例在您自己的降价链接中重复使用相关的片段。

    【讨论】:

    • 感谢您的解释。在这篇文章之后,我意识到将数字放在“组”和“资源”关键字之前是不正确的。尽管我阅读了apiary.io/blueprint,但在阅读您的答案之前无法获得捷径的概念。您更新的降价没有通过编辑器显示任何错误,但是当我尝试将它与 apiary 可执行文件一起使用以生成离线 html 页面时,我得到以下错误。应为“---”、“HOST:”或空行但找到“F”。:应为“---”、“HOST:”或空行但找到“F”。 (Line: 1, Column: 1) apib 和 md 的语法是否完全相同?
    • 我认为 Apiblueprint 和 markdown 有不同的方法来解析我们的文档。
    猜你喜欢
    • 1970-01-01
    • 2019-11-22
    • 2023-01-12
    • 2022-01-13
    • 2016-03-03
    • 1970-01-01
    • 1970-01-01
    • 2023-03-19
    • 1970-01-01
    相关资源
    最近更新 更多