diff --git a/.markdownlint.json b/.markdownlint.json index 26e33c22..c6b8b1ea 100644 --- a/.markdownlint.json +++ b/.markdownlint.json @@ -29,6 +29,11 @@ "strict": true, "code_blocks": false }, + "link-image-style": { + "collapsed": false, + "shortcut": false, + "url_inline": false + }, "no-duplicate-heading": { "siblings_only": true }, diff --git a/demo/markdownlint-browser.js b/demo/markdownlint-browser.js index e6a44e6c..fdd04a39 100644 --- a/demo/markdownlint-browser.js +++ b/demo/markdownlint-browser.js @@ -6673,7 +6673,7 @@ module.exports = { if (destination) { // link kind is an inline link var title = getTokenTextByType(descendents, "resourceTitleString"); - isError = !inline || !urlInline && autolink && !title && !image; + isError = !inline || !urlInline && autolink && !image && !title && label === destination && autolinkAble(destination); } else { // link kind is a full/collapsed/shortcut reference link var isShortcut = !children.some(function (t) { diff --git a/lib/md054.js b/lib/md054.js index 69f23078..75465647 100644 --- a/lib/md054.js +++ b/lib/md054.js @@ -64,7 +64,14 @@ module.exports = { if (destination) { // link kind is an inline link const title = getTokenTextByType(descendents, "resourceTitleString"); - isError = !inline || (!urlInline && autolink && !title && !image); + isError = !inline || ( + !urlInline && + autolink && + !image && + !title && + (label === destination) && + autolinkAble(destination) + ); } else { // link kind is a full/collapsed/shortcut reference link const isShortcut = !children.some((t) => t.type === "reference"); diff --git a/test/link-style-no-url-inline-not-possible.md b/test/link-style-no-url-inline-not-possible.md index e8fb61dc..4f200293 100644 --- a/test/link-style-no-url-inline-not-possible.md +++ b/test/link-style-no-url-inline-not-possible.md @@ -29,6 +29,24 @@ Text text {MD054} [url]: https://example.com [url-title]: https://example.com "title" +Text [link](https://example.com) text + +Text ![link](https://example.com) text + +Text [link][url] text + +Text ![link][url] text + +Text [url][] text + +Text ![url][] text + +Text [url] text + +Text ![url] text + +Text [file.md](file.md) text +