[GH-ISSUE #1391] link-image-style throws error with <foo@example.com> #2523

Closed
opened 2026-03-07 20:08:33 +03:00 by kerem · 1 comment
Owner

Originally created by @regseb on GitHub (Oct 27, 2024).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/1391

Since 0.36.0, The link-image-style rule (MD054), with { "shortcut": false } or { "url_inline": false } option, throws an error when markdown has mail surround <> (e.g. <foo@example.com>, CODE_OF_CONDUCT.md):

/home/regseb/testcase/node_modules/markdownlint/lib/md054.js:54
        destination = getDescendantsByType(link, [ "autolinkProtocol" ])[0].text;
                                                                           ^

TypeError: Cannot read properties of undefined (reading 'text')
    at Object.function (/home/regseb/testcase/node_modules/markdownlint/lib/md054.js:54:76)
    at invokeRuleFunction (/home/regseb/testcase/node_modules/markdownlint/lib/markdownlint.js:665:51)
    at forRule (/home/regseb/testcase/node_modules/markdownlint/lib/markdownlint.js:676:7)
    at Array.map (<anonymous>)
    at lintContent (/home/regseb/testcase/node_modules/markdownlint/lib/markdownlint.js:743:44)
    at lintContentWrapper (/home/regseb/testcase/node_modules/markdownlint/lib/markdownlint.js:796:12)
    at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read/context:68:3)

Node.js v22.10.0
Originally created by @regseb on GitHub (Oct 27, 2024). Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/1391 Since `0.36.0`, The [_link-image-style_](https://github.com/DavidAnson/markdownlint/blob/v0.36.0/doc/md054.md) rule (MD054), with `{ "shortcut": false }` or `{ "url_inline": false }` option, throws an error when markdown has mail surround `<>` (e.g. `<foo@example.com>`, [_CODE_OF_CONDUCT.md_](https://github.com/regseb/jfather/blob/v0.3.0/.github/CODE_OF_CONDUCT.md#enforcement)): ``` /home/regseb/testcase/node_modules/markdownlint/lib/md054.js:54 destination = getDescendantsByType(link, [ "autolinkProtocol" ])[0].text; ^ TypeError: Cannot read properties of undefined (reading 'text') at Object.function (/home/regseb/testcase/node_modules/markdownlint/lib/md054.js:54:76) at invokeRuleFunction (/home/regseb/testcase/node_modules/markdownlint/lib/markdownlint.js:665:51) at forRule (/home/regseb/testcase/node_modules/markdownlint/lib/markdownlint.js:676:7) at Array.map (<anonymous>) at lintContent (/home/regseb/testcase/node_modules/markdownlint/lib/markdownlint.js:743:44) at lintContentWrapper (/home/regseb/testcase/node_modules/markdownlint/lib/markdownlint.js:796:12) at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read/context:68:3) Node.js v22.10.0 ```
kerem 2026-03-07 20:08:33 +03:00
Author
Owner

@DavidAnson commented on GitHub (Oct 27, 2024):

Thanks, I'll fix this tonight.

<!-- gh-comment-id:2440103848 --> @DavidAnson commented on GitHub (Oct 27, 2024): Thanks, I'll fix this tonight.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/markdownlint#2523
No description provided.