parse(files[, opts], cb)var parse = require('mkapi')
, parse(['index.js'], {output: process.stdout});Accepts an array of files and iterates the file contents in series asynchronously.
Parse the comments in each file into a comment AST and transform the AST into commonmark compliant markdown.
The callback function is passed an error on failure: function(err).
Returns an event notifier.
filesArray List of files to parse.optsObject Parse options.cbFunction Callback function.
outputWritable The stream to write to, default isstdout.confObject Configuration overrides.levelNumber Initial level for the first heading, default is1.titleString Value for an initial heading.langString Language for fenced code blocks, default isjavascript.
errorwhen a processing error occurs.filewhen a file buffer is available.astwhen the comment AST is available.finishwhen all files have been parsed.
register(type[, renderer])Register a render function for a given type tag.
Without the renderer option attempts to return a render function
for the specified type.
Returns a renderer or the registry.
typeString The type name for the tag.rendererFunction The render function.
tag(name[, opts])Adds a tag to the list of known tags.
Use this to create custom tags.
Returns the tag definition.
nameString The name of the tag, do not include@.optsObject An object whose fields are merged with the tag definition.
new Tag()Encapsulates a tag definition.
Encapsulates operations on a comment AST token.
This implementation uses a cache map to look up tags in the underlying list of tags.
getDetail.prototype.getDetail([names])Get the details name, type tag and id for this comment.
Returns an object with name, type and id.
namesArray List of custom tag names.
getInfo.prototype.getInfo(method)Gets an info object containing generic tag lookups.
If the method parameter is given the object is decorated with
fields specific to the function type.
methodBoolean Inject function specific information.
find.prototype.find(id)Finds the last tag in the tag list by tag id.
Returns a tag or undefined if not found.
idString The tag identifier.
collect.prototype.collect(id)Collects all tags with the specified id.
Returns an array of tags.
idString The tag identifier.
Every aspect of the program output may be modified by changing the configuration variables.
Constants representing each of the recognised tags are exposed on this
module, for example: this.conf.MODULE yields module.
Array namesList of default tag names.
Object titleVariables for headings and notices, eg: Deprecated.
Array shorthandList of tag names that support the shorthand symbol type.
Object formatMap of format functions.
Object cuesMap of variables for visual cues.
Object renderMap of render functions.
Object includeMap of symbol types to include.
String LANG = javascript;Default language for fenced code blocks.
Provides string format functions.
heading(val, level)Gets a heading string.
Returns the heading.
valString The value for the heading.levelNumber The level for the heading.
meta(val, title)Gets a list item for the meta data.
Returns a list item for the meta data.
valObject The value for the heading.titleString A prefix for the meta item.
fenced(code, info)Gets a fenced code block.
Returns a fenced code block.
codeString The content for the code block.infoString A language info string.
deprecated(tag)Gets a deprecated notice.
Returns a deprecation notice.
tagObject The deprecated tag.
signature(params)Gets a function signature.
Returns a function signature.
paramsArray Collection of param tags.
parameter(tag)Gets a list item for parameter listings.
Returns a parameter list item.
tagObject The param tag.
returns(token, tag)Gets a returns statement.
Returns the returns value.
tokenObject the current AST token.tagObject The returns tag.
link(tag)Gets a link from a tag.
Returns formatted string.
tagObject The see tag.
getAccess(opts)Gets the access modifier for a symbol.
Returns the access for the symbol.
optsObject Format options describing the symbol.
property(tag, opts)Gets a property code string.
Returns formatted string.
tagString The declaring tag.optsObject Format options describing the property.
inherits(tag, opts)Gets the inheritance string for a class or constructor.
tagObject The declaring tag.optsObject Format options describing the function.
method(tag, opts[, title])Gets the heading title for a function.
TODOremove magic strings.tagObject The declaring tag.optsObject Format options describing the function.titleString An existing title for the function.
getTodo(tag)Gets the todo list.
Returns The list of todo items.
TODOremove magic strings.tagObject The declaring tag.
Default render functions.
Render functions are called asynchronously and must invoke the callback function to process the next comment.
_class(type, token, cb)Render a class (or module) block.
typeObject The tag that initiated the render.tokenObject The current comment AST token.cbFunction Callback function.
_function(type, token, cb)Render a function block.
typeObject The tag that initiated the render.tokenObject The current comment AST token.cbFunction Callback function.
_property(type, token, cb)Render a property block.
typeObject The tag that initiated the render.tokenObject The current comment AST token.cbFunction Callback function.
output writer helper functions.
Responsible for writing to the output output but should not perform any formatting of the output string, their role is to extract the relevant information; call a format function and write the result to the output appending newlines where necessary.
Render functions can access these methods using this.
These functions call the format functions using this.format.
heading(val, level)Write a heading at the specified level.
valString The value for the heading.levelNumber The level for the heading.
newline([num])Write one or more newlines.
numNumber The number of newlines to print, default is 1.
fenced(code)Write a fenced code block.
codeString The code content for the fenced block.
signature(params, name, lang)Write a function signature as a fenced code block.
paramsArray List of tags.nameString A name for the function.langString A language for the info string.
parameters(params)Write a list of parameters.
Used for writing param, option, throws etc.
paramsArray List of tags.
meta(token)Write meta data (author, version, since etc) and handle writing the deprecated notice.
tokenObject The current token.
describe(type, token)Print the description for a token.
typeObject The declaring type tag.tokenObject The current token.
see(token)Write the list of see also links.
tokenObject The current token.
new Writer()Writer helper functions, an instance of this class is the scope for program execution and is decorated with additional fields when parse is called.