1

我正在尝试使用 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"
        }
4

1 回答 1

0

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

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 将在左栏中为您呈现快捷方式,正如我上面所说,您可以按照我上面的示例在您自己的降价链接中重复使用相关的片段。

于 2015-04-02T01:14:39.253 回答