-
Notifications
You must be signed in to change notification settings - Fork 0
/
mume-runner.js
executable file
·41 lines (30 loc) · 1.07 KB
/
mume-runner.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
41
doc = `
Usage:
mume-runner.js <document>
mume-runner.js -h | --help | --version
`;
const {docopt} = require('docopt');
const mume = require("@shd101wyy/mume");
var arguments = docopt(doc, {
version: '0.1.0'
});
async function mumeRunner(markdownFile) {
await mume.init();
const engine = new mume.MarkdownEngine({
filePath: markdownFile,
config: {
previewTheme: "github-light.css",
// revealjsTheme: "white.css"
codeBlockTheme: "default.css",
printBackground: true,
enableScriptExecution: true, // <= for running code chunks
},
});
// html export
await engine.htmlExport({ executablePath: "./node_modules/puppeteer/.local-chromium/linux-662092/chrome-linux/chrome", offline: false, runAllCodeChunks: true });
// chrome (puppeteer) export
await engine.chromeExport({ executablePathe: "./node_modules/puppeteer/.local-chromium/linux-662092/chrome-linux/chrome", fileType: "pdf", runAllCodeChunks: true }); // fileType = 'pdf'|'png'|'jpeg'
return process.exit();
}
console.log(arguments);
mumeRunner(arguments["<document>"]);