shime / livedown

Live Markdown previews for your favorite editor.
MIT License
765 stars 51 forks source link

TypeError: TokenConstructor is not a constructor #29

Closed shime closed 6 years ago

shime commented 6 years ago

After installing livedown with

npm install -g livedown

and trying to start a preview with

livedown start README.md --open

I'm getting:

/Users/hrvoje/.nvm/versions/node/v7.3.0/lib/node_modules/livedown/node_modules/markdown-it-github-headings/index.js:73
    return Object.assign(new TokenConstructor(), token, {content: token.markup})
                         ^

TypeError: TokenConstructor is not a constructor
    at unemoji (/Users/hrvoje/.nvm/versions/node/v7.3.0/lib/node_modules/livedown/node_modules/markdown-it-github-headings/index.js:73:26)
    at Array.map (native)
    at Object.md.renderer.rules.heading_open (/Users/hrvoje/.nvm/versions/node/v7.3.0/lib/node_modules/livedown/node_modules/markdown-it-github-headings/index.js:40:56)
    at Renderer.render (/Users/hrvoje/.nvm/versions/node/v7.3.0/lib/node_modules/livedown/node_modules/markdown-it/lib/renderer.js:326:38)
    at MarkdownIt.render (/Users/hrvoje/.nvm/versions/node/v7.3.0/lib/node_modules/livedown/node_modules/markdown-it/lib/index.js:543:24)
    at /Users/hrvoje/.nvm/versions/node/v7.3.0/lib/node_modules/livedown/server.js:89:36
    at tryToString (fs.js:425:3)
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:412:12)

It looks like the issue with markdown-it-github-headings. @niftylettuce?

shime commented 6 years ago

It breaks when emoji is in the heading.

niftylettuce commented 6 years ago

will take a look here

niftylettuce commented 6 years ago

@shime I've went ahead and submitted a pull request and filed an issue here https://github.com/Flet/markdown-it-github-headings/issues/7. Once this is accepted, merged, and released, I will bump the version in livedown and publish a new version. Also note that I recently published a new version as well, since I swapped the checkbox plugin for one that is more closer in style to GitHub. Thanks!

niftylettuce commented 6 years ago

See v2.0.3 @shime, thanks, already published to NPM