A flexible documentation generator and source code parser.
Note: Mia is still in alpha status, right now it only comes with a few basic modules for parsing standard, prototypical code and it's own doc format.
It tries to be open minded about the source code it is parsing and not make any particular assumptions about structure or style.
Mia works in 3 steps:
First Mia needs to parse the code in question, this is done by calling
mia.parse() and specifying the parsers to be run over the source.
var mia = require'mia'fs = require'fs';var source = fsreadFileSync'source.js'toString;var module = miaparse'Module' // Name of the modulesourcemodule: 'iife' // Detect standard anonymous function wrapperssource: 'prototypical' // Detect standrad prototypical classesannotation: 'mia' // Use mia annotations;
module will be a serializable JSON structure which contains all information
returned by the different parsers. An example can be found in this gist.
While the structure already contains all the required information to build documentation from it, the data is still not combined in a template friendly way.
mia.generate() with the module and the matching generator a nicer
structure can be generated which is easy to work with using standard template engines.
var template = miageneratemodule 'mia';
Below is a list of the parsers Mia currently ships with.:
It is easy to extend as you can just pass your custom functions to Mia instead of a parser name.
The following generators are currently included:
Mia is licenses under MIT.