Integrate mdpdf as the primary converter
See original GitHub issueChanging because the output of mdpdf
looks so great.
Finally now getting around to starting this.
I have one commit pushed to this branch, but am getting an error regarding atom’s content security policy, like this:
Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self'".
at Object.createFunctionContext (/home/travis/github/markdown-pdf/node_modules/handlebars/dist/cjs/handlebars/compiler/javascript-compiler.js:254:23)
at Object.compile (/home/travis/github/markdown-pdf/node_modules/handlebars/dist/cjs/handlebars/compiler/javascript-compiler.js:142:19)
at compileInput (/home/travis/github/markdown-pdf/node_modules/handlebars/dist/cjs/handlebars/compiler/compiler.js:517:53)
at ret (/home/travis/github/markdown-pdf/node_modules/handlebars/dist/cjs/handlebars/compiler/compiler.js:524:18)
at readFile.then.then.then.then.md (/home/travis/github/markdown-pdf/node_modules/mdpdf/index.js:161:16)
at tryCatcher (/home/travis/github/markdown-pdf/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/home/travis/github/markdown-pdf/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/home/travis/github/markdown-pdf/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (/home/travis/github/markdown-pdf/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/home/travis/github/markdown-pdf/node_modules/bluebird/js/release/promise.js:693:18)
at Promise._fulfill (/home/travis/github/markdown-pdf/node_modules/bluebird/js/release/promise.js:638:18)
at /home/travis/github/markdown-pdf/node_modules/bluebird/js/release/nodeback.js:42:21
at tryToString (fs.js:455:3)
at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:442:12)
It appears that this is due to some eval
call in mdpdf
(most likely in one of its dependencies), but I couldn’t find such a call.
I have tried wrapping the mdpdf
usage in loophole to escape the CSP, but I still get the error.
I would much rather use the mdpdf
API, but if I can’t get this resolved then we may have to resort to calling mdpdf
from the command line in a child process (not a clean solution).
@BlueHatbRit
Do you have any idea of where such a call may be in the mdpdf
stack? If so, maybe I can help make a workaround that lets us use mdpdf
inside atom given its current CSP.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:22 (8 by maintainers)
@BlueHatbRit Looks great, thanks!
@travs oh that’s great thanks, you did all the work so I wouldn’t want my name anywhere else haha.
Here’s the link back if you wanted to check it out -> https://github.com/BlueHatbRit/mdpdf/commit/8fade1b3db7fb23e6e244c9bd8cca1e0d6e14767. I’ll be pushing it to npm later on today.