39 lines
943 B
Markdown
39 lines
943 B
Markdown
# doc
|
|
|
|
|
|
Provides a consistent way to create documentation for prosperon elements. Objects are documented by adding docstrings directly to object-like things (functions, objects, ...), or to an object's own "doc object".
|
|
|
|
Docstrings are set to the symbol `cell.DOC`
|
|
|
|
```js
|
|
// Suppose we have a module that returns a function
|
|
function greet(name) { log.console("Hello, " + name) }
|
|
|
|
// We can attach a docstring
|
|
greet.doc = `
|
|
Greets the user by name.
|
|
`
|
|
|
|
// A single function is a valid return!
|
|
return greet
|
|
```
|
|
|
|
```js
|
|
// Another way is to add a docstring object to an object
|
|
var greet = {
|
|
hello() { log.console('hello!') }
|
|
}
|
|
|
|
greet[cell.DOC] = {}
|
|
greet[cell.DOC][cell.DOC] = 'An object full of different greeter functions'
|
|
greet[cell.DOC].hello = 'A greeter that says, "hello!"'
|
|
```
|
|
|
|
|
|
**name**: The name of the person to greet.
|
|
|
|
|
|
### writeDocFile(obj, title) <sub>function</sub>
|
|
|
|
Return a markdown string for a given obj, with an optional title.
|