valeriangalliat / markdown-it-anchor

A markdown-it plugin that adds an `id` attribute to headings and optionally permalinks.
The Unlicense
292 stars 72 forks source link

TypeError: linkTokens[position[(!opts.permalinkBefore)]](...) is not a function #39

Closed buddh4 closed 6 years ago

buddh4 commented 6 years ago

I've added this plugin to my rollup build (by npm) and I get the following error when enabling the permlinks:

TypeError: linkTokens[position[(!opts.permalinkBefore)]](...) is not a function

This happens in line https://github.com/valeriangalliat/markdown-it-anchor/blob/master/index.js#L33

The rollup output of those lines are:

linkTokens[position[!opts.permalinkBefore]](space())
(ref = state.tokens[idx + 1].children)[position[opts.permalinkBefore]].apply(ref, linkTokens);

a simple semicolon after the first line would solve this issue:

linkTokens[position[!opts.permalinkBefore]](space());
nagaozen commented 6 years ago

@buddh4, are you still experiencing this? According to the project linter standard, this extra semicolon isn't required.

buddh4 commented 6 years ago

Haven't tried it since then. I've just added the file manually with the extra semicolon. I assume its rather a rollup issue.

buddh4 commented 6 years ago

I've tested it again seems to be fine now!

nagaozen commented 6 years ago

Thank you