npm / marky-markdown

npm's markdown parser
https://www.npmjs.com/package/@npmcorp/marky-markdown
405 stars 71 forks source link

fix Uncaught TypeError: Cannot read property 'highlightSync' of undefined #398

Closed chenxsan closed 7 years ago

chenxsan commented 7 years ago

Since browser side highlight is not supported, and the default highlightSyntax is set to true, I just ran into this error easily:

screen shot 2017-07-08 at 11 33 46 pm

The problem is at https://github.com/npm/marky-markdown/blob/master/lib/render.js#L66 where highlighter is undefined because it's only require when typeof process.browser === 'undefined'.

This pull request should hopefully fix it.