Autodoc can generate documentation for Jsonnet code, optionally annotated with code comments.
While any comments are processed, the goal is to parse and pretty print JSDoc annotations.
Caution
This is an experimental library.
- func new
- func new().render
- func new().generateIndex
- func new().findRootObject
- func new().renderObject
- func new().documentableFields
- func new().fieldName
- func new().filterFunctionFields
- func new().filterAnonymousFunctionFields
- func new().filterObjectFields
- func new().renderFieldFunction
- func new().renderAnonymousFunction
- func new().renderFunction
- func new().getCommentBeforeLine
new(title, file)new creates a new autodoc parser
- @constructor
- @param {string} - title
- @param {string} - file (example:
imporstr './main.libsonnet') - @returns {object}
render(depth=0)render processes the file into Markdown
- @param {number} - [depth=0]
- @returns {string}
generateIndex(lines)findRootObject(ast)renderObject(object, parents=[], depth, noHeader=false)documentableFields(object)Find fields that can be documented.
This essentially filters out calculated fields in the form of [<expr>].
fieldName(field)Get the field name, this assumes fieldname.type is either string or id.
Use documentableFields() to filter these out.
filterFunctionFields(fields)filterAnonymousFunctionFields(fields)filterObjectFields(fields)renderFieldFunction(field, parents, depth)renderAnonymousFunction(field, parents, depth)renderFunction(name, signature, docstring, depth)getCommentBeforeLine(lineNr)