elliotblackburn / mdpdf

Markdown to PDF command line app with support for stylesheets
https://npmjs.com/package/mdpdf
Apache License 2.0
718 stars 48 forks source link

Cannot read property 'pre' of undefined #99

Open orafaaraujo opened 3 years ago

orafaaraujo commented 3 years ago

mdpdf CHANGELOG.md

TypeError: Cannot read property 'pre' of undefined
    at showdownHighlight (/usr/local/lib/node_modules/mdpdf/node_modules/showdown-highlight/lib/index.js:32:23)
    at _parseExtension (/usr/local/lib/node_modules/mdpdf/node_modules/showdown/dist/showdown.js:2301:13)
    at Array.forEach (<anonymous>)
    at Object.showdown.helper.forEach (/usr/local/lib/node_modules/mdpdf/node_modules/showdown/dist/showdown.js:653:9)
    at _constructor (/usr/local/lib/node_modules/mdpdf/node_modules/showdown/dist/showdown.js:2266:23)
    at new showdown.Converter (/usr/local/lib/node_modules/mdpdf/node_modules/showdown/dist/showdown.js:2238:3)
    at parseMarkdownToHtml (/usr/local/lib/node_modules/mdpdf/src/index.js:69:21)
    at /usr/local/lib/node_modules/mdpdf/src/index.js:115:21
    at tryCatcher (/usr/local/lib/node_modules/mdpdf/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/usr/local/lib/node_modules/mdpdf/node_modules/bluebird/js/release/promise.js:547:31)
    at Promise._settlePromise (/usr/local/lib/node_modules/mdpdf/node_modules/bluebird/js/release/promise.js:604:18)
    at Promise._settlePromise0 (/usr/local/lib/node_modules/mdpdf/node_modules/bluebird/js/release/promise.js:649:10)
    at Promise._settlePromises (/usr/local/lib/node_modules/mdpdf/node_modules/bluebird/js/release/promise.js:729:18)
    at Promise._fulfill (/usr/local/lib/node_modules/mdpdf/node_modules/bluebird/js/release/promise.js:673:18)
    at /usr/local/lib/node_modules/mdpdf/node_modules/bluebird/js/release/nodeback.js:42:21
    at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:75:3)

Hi, I'm trying to use the mdpdf but I'm facing the issue above.

My versions are node: 15.5.1 npm: 7.10.0 mdpdf: 2.1.2

Any clue what might be happening?

Thank you

lonesomegeek commented 3 years ago

Seems like a problem in showdown-highlight dependency.

Same problem here.

turpoint commented 3 years ago

Same here

orafaaraujo commented 3 years ago

I could make it work using a fixed version:

npm install mdpdf@2.1.1 -g
Flou21 commented 3 years ago

same, with fixed version it worked