textlint-rule/textlint-rule-no-dead-link

Don't check reference-style links

Closed this issue · 1 comments

Hello.
This rule is not validating links in reference-style. For example:

(some link text)[1]

[1]: https://foo.bar

Plugin is simply ignore it, but error expected.

azu commented

Thanks for report.

This rule is not validating links in reference-style.

Yes. Currently this rule does not support it.

Probably, we can support reference-style by following imeplemtation.
(I did not test the code)

// Similar with https://github.com/textlint-rule/textlint-rule-no-dead-link/blob/3984344d642e0323903d6d34326d02f6a33be269/src/no-dead-link.js#L223
    ["Definition"](node) {
      if (typeof node.url === 'undefined') {
        return;
      }

      // [1]: http://example.com
      //      ^
      const index = node.raw.indexOf(node.url) || 0;

      URIs.push({
        node,
        uri: node.url,
        index,
      });
   },

📝 Note: Definition Node type is markdown specific.
(It is not a parts of TxtAST)

image