arve0 / markdown-it-attrs

Add classes, identifiers and attributes to your markdown with {} curly brackets, similar to pandoc's header attributes
MIT License
300 stars 58 forks source link

bugfix in exports.addAttrs -- handle undefined token #120

Closed sajozsattila closed 2 years ago

arve0 commented 3 years ago

Hi 👋 Thanks for the patch. It is not obvious to me, why addAttrs is called without a token. Probably one of these?

168:        utils.addAttrs(attrs, tokens[ii - 1]);
234:        utils.addAttrs(attrs, tokens[i - 2]);

Probably solves issue https://github.com/arve0/markdown-it-attrs/issues/119? Do you have a test case, or a stack trace? I might want to fix the issue at the calling site, patterns.js that is.