Compare commits
1 commit
master
...
gitea-modi
Author | SHA1 | Date | |
---|---|---|---|
5c7f8b048e |
1 changed files with 5 additions and 1 deletions
|
@ -29,6 +29,8 @@ Arguments:
|
|||
Options:
|
||||
-d --debug Print debug messages.
|
||||
|
||||
-f --fragment Output HTML fragment insted of full page.
|
||||
|
||||
-s --style <file,...> Comma separated stylesheet(s) to embed into the output
|
||||
HTML. The stylesheet may be a path to a CSS file,
|
||||
"@base" for the base ipynb2html style, or "@default"
|
||||
|
@ -56,6 +58,7 @@ function arrify <T> (obj: T | T[]): T[] {
|
|||
function parseCliArgs (argv: string[]) {
|
||||
const opts = minimist(argv, minimistOptions({
|
||||
debug: { alias: 'd', type: 'boolean' },
|
||||
fragment: { alias: 'f', type: 'boolean' },
|
||||
style: { alias: 's', type: 'string', default: '@default' },
|
||||
version: { alias: 'V', type: 'boolean' },
|
||||
help: { alias: 'h', type: 'boolean' },
|
||||
|
@ -90,6 +93,7 @@ function parseCliArgs (argv: string[]) {
|
|||
return {
|
||||
styles: arrify(opts.style).join(',').split(/,\s*/),
|
||||
debug: opts.debug as boolean,
|
||||
fragment: opts.fragment as boolean,
|
||||
input: input === '-' ? 0 : input, // 0 = stdin
|
||||
output,
|
||||
}
|
||||
|
@ -116,7 +120,7 @@ export default (argv: string[]): void => {
|
|||
const renderNotebook = ipynb2html.createRenderer(new Document())
|
||||
const contents = renderNotebook(notebook).outerHTML
|
||||
|
||||
const html = renderPage({ contents, title, style })
|
||||
const html = opts.fragment ? contents : renderPage({ contents, title, style })
|
||||
|
||||
if (opts.output) {
|
||||
fs.writeFileSync(opts.output, html)
|
||||
|
|
Loading…
Reference in a new issue