Contributte Anabelle
# Content
# Api documentation generator (JSON-RPC / REST)
No matter whether you're using REST or JSON-RPC or some other api architecture/scheme
# Extended Markdown syntax
# #include <file.md>
#include variables.md
1
# $variable = <value>
$uuid = 123e4567-e89b-12d3-a456-426655440000
1
Inline variable usage
User uuid is {$uuid}
1
# $$blockVariable ... $$
$$successEmptyResponse
{
"jsonrpc": "2.0",
"result": {},
"id": null
}
$$
1
2
3
4
5
6
7
2
3
4
5
6
7
Block variable usage
Server returns response:
{$$successEmptyResponse}
1
2
3
2
3
# @ <sectionName>:<sectionFile.md>
High-level section definition. This macro available only in index.md
file.
@ Home:home.md
@ About project:about.md
1
2
2
# @@ <sectionName>:<sectionFile.md>
Method section definition. This macro available only in index.md
file.
@@ user.login:methods/user.login.md
@@ user.logout:methods/user.logout.md
@@ user.register:methods/user.register.md
@@ user.confirm-registration:methods/user.confirm-registration.md
1
2
3
4
2
3
4
# [File link](foo/bar/data.json)
File link will create a link to file (foo/bar/data.json
). The file will be copied to documentation output directory for safety reasons.
[File link](foo/bar/data.json)
[Project root directory file link](../app/schema/user.json)
1
2
2
# How to use anabelle
cd myApi
composer require contributte/anabelle
vendor/bin/anabelle docs-src docs
1
2
3
2
3
# CLI options
# Automatically overwrite output directory
vendor/bin/anabelle docs-src docs -o
// Or
vendor/bin/anabelle docs-src docs --overwriteOutputDir
1
2
3
2
3
# Add http auth to generated files
Beware! Anabelle generates by default .html files. If you are using http auth, it generates .php files due to the need of validating http auth headers.
vendor/bin/anabelle docs-src docs -u user -p pass
// Or
vendor/bin/anabelle docs-src docs --httpAuthUser user -httpAuthPass pass
1
2
3
2
3
# Generator workflow
- Most important (and only required) file is
index.md
. In this file, you can use only (different Markdown markup is ignored inindex.md
):# <h1>
## <h2>
#include <file.md>
$variable = <value>
$$blockVariable ... $$
@ <sectionName>:<sectionFile.md>
@@ <sectionName>:<sectionFile.md>
)
#include
macros are replaced<h1>
is used as documentation page title (only the first found one is used)<h2>
can be used wherever you want in the sidebar@
and@@
sections are rendered in the sidebar nav- Content of
@
and@@
sections is rendered into separate files and loaded into the main section detail after clicking particular section link in the nav
# Examples
- http://github.com/contributte/playground/tree/master/contributte-anabelle (opens new window) (example project)
- https://examples.contributte.org/packages/anabelle/ (opens new window) (generated documentation)
- https://github.com/contributte/playground (opens new window) (playground)
- https://contributte.org/examples.html (opens new window) (more examples)