forked from amyreese/markdown-pp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
markdownpp.js
40 lines (36 loc) · 1009 Bytes
/
markdownpp.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
var markdownpp = require('./index.js');
var argv = require('yargs')
.usage('Usage: markdownpp {infile} [-o outfile] [-l] [-e excluded,modules]')
.help('h')
.alias('h','help')
.string('outfile')
.alias('o','outfile')
.describe('outfile','the output file')
.string('exclude')
.alias('e','exclude')
.describe('exclude','the list of modules to exclude')
.boolean('list')
.alias('l','list')
.describe('list','list modules')
.alias('h','help')
.strict()
.version(function() {
return require('../package.json').version;
})
.argv;
if (argv.exclude) {
var exclusions = argv.exclude.split(',');
for (var ex of exclusions) {
if (typeof markdownpp.modules[ex] === 'boolean') {
markdownpp.modules[ex] = false;
}
}
}
if (argv.list) {
for (var m in markdownpp.modules) {
console.log(m+' '+markdownpp.modules[m]);
}
}
if (argv._.length>0) {
markdownpp.render(argv._[0],argv.outfile);
}