-
-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Mark
no-auto-link-without-protocol
as deprecated
* Add internal support for deprecated packages in tooling * Remove `remark-lint-no-auto-link-without-protocol` from presets * Add info to `remark-lint-no-auto-link-without-protocol` on why it’s deprecated Related to remarkjs/remark#863.
- Loading branch information
Showing
13 changed files
with
337 additions
and
435 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/remark-lint-no-auto-link-without-protocol/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,112 +10,11 @@ | |
[![Backers][backers-badge]][collective] | ||
[![Chat][chat-badge]][chat] | ||
|
||
Warn for autolinks without protocol. | ||
Autolinks are URLs enclosed in `<` (less than) and `>` (greater than) | ||
characters. | ||
|
||
## Fix | ||
|
||
[`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify) | ||
adds a protocol where needed. | ||
|
||
See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) | ||
on how to automatically fix warnings for this rule. | ||
|
||
## Presets | ||
|
||
This rule is included in the following presets: | ||
|
||
| Preset | Setting | | ||
| - | - | | ||
| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-markdown-style-guide) | | | ||
| [`remark-preset-lint-recommended`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-recommended) | | | ||
|
||
## Example | ||
|
||
##### `ok.md` | ||
|
||
###### In | ||
|
||
```markdown | ||
<http://www.example.com> | ||
<mailto:[email protected]> | ||
|
||
Most Markdown vendors don’t recognize the following as a link: | ||
<www.example.com> | ||
``` | ||
|
||
###### Out | ||
|
||
No messages. | ||
|
||
##### `not-ok.md` | ||
|
||
###### In | ||
|
||
```markdown | ||
<[email protected]> | ||
``` | ||
|
||
###### Out | ||
|
||
```text | ||
1:1-1:14: All automatic links must start with a protocol | ||
``` | ||
|
||
## Install | ||
|
||
This package is [ESM only][esm]: | ||
Node 12+ is needed to use it and it must be `imported`ed instead of `required`d. | ||
|
||
[npm][]: | ||
|
||
```sh | ||
npm install remark-lint-no-auto-link-without-protocol | ||
``` | ||
|
||
This package exports no identifiers. | ||
The default export is `remarkLintNoAutoLinkWithoutProtocol`. | ||
|
||
## Use | ||
|
||
You probably want to use it on the CLI through a config file: | ||
|
||
```diff | ||
… | ||
"remarkConfig": { | ||
"plugins": [ | ||
… | ||
"lint", | ||
+ "lint-no-auto-link-without-protocol", | ||
… | ||
] | ||
} | ||
… | ||
``` | ||
|
||
Or use it on the CLI directly | ||
|
||
```sh | ||
remark -u lint -u lint-no-auto-link-without-protocol readme.md | ||
``` | ||
|
||
Or use this on the API: | ||
|
||
```diff | ||
import {remark} from 'remark' | ||
import {reporter} from 'vfile-reporter' | ||
import remarkLint from 'remark-lint' | ||
import remarkLintNoAutoLinkWithoutProtocol from 'remark-lint-no-auto-link-without-protocol' | ||
|
||
remark() | ||
.use(remarkLint) | ||
+ .use(remarkLintNoAutoLinkWithoutProtocol) | ||
.process('_Emphasis_ and **importance**') | ||
.then((file) => { | ||
console.error(reporter(file)) | ||
}) | ||
``` | ||
This rule is no longer recommended for use. | ||
With CommonMark, all autolinks (except for emails) are required to have a | ||
protocol. | ||
Otherwise they don’t parse. | ||
The previous suggestion to add a protocol to email autolinks was wrong. | ||
|
||
## Contribute | ||
|
||
|
@@ -157,10 +56,6 @@ abide by its terms. | |
|
||
[chat]: https://github.com/remarkjs/remark/discussions | ||
|
||
[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c | ||
|
||
[npm]: https://docs.npmjs.com/cli/install | ||
|
||
[health]: https://github.com/remarkjs/.github | ||
|
||
[contributing]: https://github.com/remarkjs/.github/blob/HEAD/contributing.md | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.