Showing
1 changed file
with
4 additions
and
3 deletions
| ... | @@ -14,8 +14,8 @@ program | ... | @@ -14,8 +14,8 @@ program |
| 14 | .command('export <markdown_file> [html_file]') | 14 | .command('export <markdown_file> [html_file]') |
| 15 | .alias('e') | 15 | .alias('e') |
| 16 | .description('export markdown to html') | 16 | .description('export markdown to html') |
| 17 | - .option('-A --abstract', 'abstract to current path') | 17 | + .option('-T --theme [theme_name]', 'css theme for html') |
| 18 | - .action(function (md, html) { | 18 | + .action(function (md, html, options) { |
| 19 | //判断目标输出参数 | 19 | //判断目标输出参数 |
| 20 | if (!fs.existsSync(md)) { | 20 | if (!fs.existsSync(md)) { |
| 21 | console.error(chalk.red(md + ' is not found')); | 21 | console.error(chalk.red(md + ' is not found')); |
| ... | @@ -33,7 +33,8 @@ program | ... | @@ -33,7 +33,8 @@ program |
| 33 | fs.ensureFileSync(output); | 33 | fs.ensureFileSync(output); |
| 34 | 34 | ||
| 35 | const viewer = new (require('../lib/view-markdown'))(process.cwd(), {inline: true}); | 35 | const viewer = new (require('../lib/view-markdown'))(process.cwd(), {inline: true}); |
| 36 | - let result = viewer.render(md, 'metro-lake'); | 36 | + let theme = options.theme || 'news'; |
| 37 | + let result = viewer.render(md, theme); | ||
| 37 | 38 | ||
| 38 | fs.writeFile(output, result); | 39 | fs.writeFile(output, result); |
| 39 | console.log('html is exported to', chalk.green(output)) | 40 | console.log('html is exported to', chalk.green(output)) | ... | ... |
-
Please register or login to post a comment