DocBox Output Example
On this page
DocBox Output Example
A real example of what bxSites docbox produces. Every page
below came out of an actual run against the source shown - nothing here is
hand-written illustration.
Given this class in a project's models/ folder:
/**
* A single book on the shelf, immutable once created.
*
* @author Ortus Solutions
*/
class singleton accessors=true {
/**
* The book's title
*/
property name="title" type="string";
/**
* Where book records are read from
*/
property name="datasource" type="string" inject="coldbox:setting:bookDatasource";
/**
* Build a book.
*
* @title The book's title
* @author The book's author
*/
function init( required string title, string author = "Unknown" ) {
return this
}
/**
* Return a copy of this book with a new title.
*
* @newTitle The replacement title
*
* @return a copy carrying the new title
*/
Book function withTitle( required string newTitle ) {}
private function normalize() {}
}
...bxSites docbox writes api/docbox/models/Book.md with this
frontmatter:
---
title: "Book"
summary: "A single book on the shelf, immutable once created."
tags: [api, docbox]
---
And this body, reproduced below not as a code block but rendered for real - this is the generated page's actual body, live, including the filter toolbar. Try the Private chip, or type "title" into the search box:
Book
models.Book ยท Class
A single book on the shelf, immutable once created.
Annotations
@accessorstrue@singleton
Properties
| Property | Type | Default | Description |
|---|---|---|---|
title | string | โ | The book's title |
datasource | string | โ | Where book records are read from @inject coldbox:setting:bookDatasource |
What to notice
- The properties table exists at all. DocBox's own JSON strategy drops
declared
propertyblocks; bx-sites reads them back from the same class metadata DocBox used, which is whytitleanddatasourceappear here with their hints intact - and why the WireBoxinjectondatasourcesurvives, since that's how a ColdBox model declares its wiring. @returntext survives too, for the same reason - see the Returns line underwithTitle.- Private methods are included, unlike the Javadoc generator's public/protected-only rule. DocBox reports them, so they're documented, and the Private chip filters them away when you don't want them.
initis the constructor, given its own section ahead of the methods.
The index pages
Alongside the class pages, the same run writes an overview index listing every package and class, and one index per package:
# Bookshelf API
## Packages
| Package | Classes |
|---|---|
| [`models`](models/index.md) | 1 |
## Classes
- [`Book`](models/Book.md)
See DocBox API Reference for configuration, and ColdBox Output Example for what the ColdBox verb produces from the same project.