Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add remarkable-options-path option #140

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion bin/markdown-pdf
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env node

var markdownpdf = require('../')
var fs = require('fs');
var program = require('commander')

program.version(require('../package.json').version)
Expand All @@ -12,6 +13,7 @@ program.version(require('../package.json').version)
.option('-s, --css-path [path]', 'Path to custom CSS file')
.option('-z, --highlight-css-path [path]', 'Path to custom highlight-CSS file')
.option('-m, --remarkable-options [json-options]', 'Options to pass to remarkable')
.option('-j, --remarkable-options-path [path]', 'Path to json file to pass to remarkable')
.option('-f, --paper-format [format]', '"A3", "A4", "A5", "Legal", "Letter" or "Tabloid"')
.option('-r, --paper-orientation [orientation]', '"portrait" or "landscape"')
.option('-b, --paper-border [measurement]', 'Supported dimension units are: "mm", "cm", "in", "px"')
Expand All @@ -24,13 +26,21 @@ if (program.args.length === 0) program.help()

program.out = program.out || program.args[0].replace(/\.m(ark)?d(own)?/gi, '') + '.pdf'

var remarkableOptions = null
if (program.remarkableOptions) {
remarkableOptions = JSON.parse(program.remarkableOptions)
} else if (program.remarkableOptionsPath) {
jsonText = fs.readFileSync(program.remarkableOptionsPath)
remarkableOptions = JSON.parse(jsonText)
}

var opts = {
cwd: program.cwd,
phantomPath: program.phantomPath,
runningsPath: program.runningsPath,
cssPath: program.cssPath,
highlightCssPath: program.highlightCssPath,
remarkable: program.remarkableOptions ? JSON.parse(program.remarkableOptions) : null,
remarkable: remarkableOptions,
paperFormat: program.paperFormat,
paperOrientation: program.paperOrientation,
paperBorder: program.paperBorder,
Expand Down