Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crash when a list item containing only a link has an attribute set at its front #128

Closed
grant-g opened this issue Aug 18, 2021 · 1 comment

Comments

@grant-g
Copy link

grant-g commented Aug 18, 2021

I realize that putting a list item's attribute at its front is not spec'd as being supported, so perhaps this is low priority. Am just passing this along since crashes are never good.)

Markdown-it versions:

% npm ls | grep markdown-it
├─┬ [email protected]
└── [email protected]

Snippet to run:

var md = require('markdown-it')();
var markdownItAttrs = require('markdown-it-attrs');
md.use(markdownItAttrs, {});
md.render('- {#hi} [link1](./link1)');

Resulting dump:

TypeError: Cannot read property 'type' of undefined
    at Object.exports.getMatchingOpeningToken (/Users/grant/git/marked-it-cli/node_modules/markdown-it-attrs/utils.js:269:17)
    at Object.transform (/Users/grant/git/marked-it-cli/node_modules/markdown-it-attrs/patterns.js:170:34)
    at Array.curlyAttrs (/Users/grant/git/marked-it-cli/node_modules/markdown-it-attrs/index.js:33:19)
    at Core.process (/Users/grant/git/marked-it-cli/node_modules/markdown-it/lib/parser_core.js:51:13)
    at MarkdownIt.parse (/Users/grant/git/marked-it-cli/node_modules/markdown-it/lib/index.js:524:13)
    at MarkdownIt.render (/Users/grant/git/marked-it-cli/node_modules/markdown-it/lib/index.js:544:36)
    at Object.<anonymous> (/Users/grant/git/marked-it-cli/test.js:4:4)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
arve0 added a commit that referenced this issue Dec 30, 2021
tests with shift -1 was rolling around to end of array
when matching first child token
@arve0
Copy link
Owner

arve0 commented Dec 30, 2021

Hi 👋 Thanks for reporting! Has been fixed in v4.1.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants