medfreeman / markdown-it-toc-and-anchor

markdown-it plugin to add a toc and anchor links in headings
MIT License
60 stars 35 forks source link

vue.esm.js?af24:1741 TypeError: link.attrIndex is not a function #61

Open CaledoniaProject opened 5 years ago

CaledoniaProject commented 5 years ago

Looks link.attrIndex could be undefined:

vue.esm.js?af24:1741 TypeError: link.attrIndex is not a function
    at findFirstMatchingConfig (index.js?47a1:7)
    at Object.md.renderer.rules.link_open (index.js?47a1:54)
    at Renderer.renderInline (renderer.js?1643:271)
    at Renderer.render (renderer.js?1643:324)
    at MarkdownIt.render (index.js?cf6b:543)
    at VueComponent.markdown2html (index.js?58b7:19)

Relevant code:

function findFirstMatchingConfig (link, configs) {
  var i, config
  var href = link.attrs[link.attrIndex('href')][1]