A tool that parses and executes JavaScript from Markdown, akin to Literate CoffeeScript. Check out the annotated source or the docs below.
npm install -g erudite
Usage: erudite [options] /path/to/filename
-h, --help show this help text
-o, --outfile write to the given file path
-e, --stage ECMAScript proposal stage (0-4)
--stdout write to stdout (ignores -o)
erudite
exports a single function which parses and executes a given buffer of
Markdown text:
var fs = require('fs');
var erudite = require('erudite');
var filename = './literate-javascript.md';
var text = fs.readFileSync(filename, 'utf8');
erudite(text, {
filename: filename
});
You can also parse and execute separately:
var source = erudite.parse(buf);
erudite.exec(source, opts);
text
A string of Markdown text to processopts
A configuration objecteol
(Optional) The string to use to concatenate code blocks (defaults toos.EOL
)
src
A string of JavaScript source codeopts
A configuration objectfilename
(Optional) The name of the source file (defaults toerudite
)
MIT