Skip to content

Add lint to prevent (most) URLs #104

@SamWilsn

Description

@SamWilsn

Summary

Many authors attempt to bypass markdown-rel-links by putting their URL in backticks:

Check out `https://google.com`.

We should add a lint to make sure that all HTTP(S) URLs that are not hyperlinked (so in code fences, backticks, plain text, etc.) use example domains. Specifically, the following (and any subdomains thereof) would be allowed:

  • example
  • example.com
  • example.net
  • example.org
  • invalid
  • test

Examples

Disallowed

The following snippets should trigger this lint:

  • Check out `https://google.com/hello`.
    • Disallowed because:
      • the domain is not on the list above; and
      • the URL is not in a link.
  • With the following command:
    
    ```
    curl https://google.com/hello
    ```
    • Disallowed because:
      • the domain is not on the list above; and
      • the URL is not in a link.
  • Here is an unhyperlinked link http://google.com
    • Disallowed because:
      • the domain is not on the list above; and
      • the URL is not in a link.

Allowed

While the following should not trigger this lint:

  • Check out `https://example.com/hello`.
    • Allowed because the domain is on the approved list above.
  • With the following command:
    
    ```
    curl https://google.com.invalid/hello
    ```
    • Allowed because the domain is on the approved list above.
  • <https://google.com>
    • Allowed because the URL appears in a link.
  • [boop](https://google.com)
    • Allowed because the URL appears in a link.
  • [boop]
    [boop]: https://google.com
    • Allowed because the URL appears in a link.

Metadata

Metadata

Assignees

Labels

ready to implementFeature has reached rough consensus among editors and is ready to be implemented

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions