Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

remark-lint-no-literal-urls

Package Overview
Dependencies
Maintainers
2
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

remark-lint-no-literal-urls - npm Package Compare versions

Comparing version 3.1.0 to 3.1.1

4

index.d.ts
export default remarkLintNoLiteralUrls
export type Root = import('mdast').Root
declare const remarkLintNoLiteralUrls: import('unified').Plugin<
| void[]
| [unknown]
| void[]
| [
(
| boolean
| import('unified-lint-rule').Label
| import('unified-lint-rule').Severity
| import('unified-lint-rule').Label
),

@@ -12,0 +12,0 @@ unknown

/**
* @author Titus Wormer
* @copyright 2015 Titus Wormer
* @license MIT
* @module no-literal-urls
* @fileoverview
* Warn for literal URLs in text.
* URLs are treated as links in some Markdown vendors, but not in others.
* To make sure they are always linked, wrap them in `<` (less than) and `>`
* (greater than).
* ## When should I use this?
*
* ## Fix
* You can use this package to check that autolink literal URLs are not used.
*
* [`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify)
* never creates literal URLs and always uses `<` (less than) and `>`
* (greater than).
* ## API
*
* 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.
* There are no options.
*
* ## Recommendation
*
* Autolink literal URLs (just a URL) are a feature enabled by GFM.
* They don’t work everywhere.
* Due to this, it’s recommended to instead use normal autolinks
* (`<https://url>`) or links (`[text](url)`).
*
* ## Fix
*
* [`remark-stringify`](https://github.com/remarkjs/remark/tree/main/packages/remark-stringify)
* never creates autolink literals and always uses normal autolinks (`<url>`).
*
* @module no-literal-urls
* @summary
* remark-lint rule to warn for autolink literals.
* @author Titus Wormer
* @copyright 2015 Titus Wormer
* @license MIT
* @example

@@ -22,0 +29,0 @@ * {"name": "ok.md"}

{
"name": "remark-lint-no-literal-urls",
"version": "3.1.0",
"version": "3.1.1",
"description": "remark-lint rule to warn when URLs without angle brackets are used",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -13,16 +13,30 @@ <!--This file is generated-->

Warn for literal URLs in text.
URLs are treated as links in some Markdown vendors, but not in others.
To make sure they are always linked, wrap them in `<` (less than) and `>`
(greater than).
[`remark-lint`][mono] rule to warn for autolink literals.
## Fix
## Contents
[`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify)
never creates literal URLs and always uses `<` (less than) and `>`
(greater than).
* [What is this?](#what-is-this)
* [When should I use this?](#when-should-i-use-this)
* [Presets](#presets)
* [Install](#install)
* [Use](#use)
* [API](#api)
* [`unified().use(remarkLintNoLiteralUrls[, config])`](#unifieduseremarklintnoliteralurls-config)
* [Recommendation](#recommendation)
* [Fix](#fix)
* [Examples](#examples)
* [Compatibility](#compatibility)
* [Contribute](#contribute)
* [License](#license)
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.
## What is this?
This package is a [unified][] ([remark][]) plugin, specifically a `remark-lint`
rule.
Lint rules check markdown code style.
## When should I use this?
You can use this package to check that autolink literal URLs are not used.
## Presets

@@ -37,50 +51,56 @@

## Example
## Install
##### `ok.md`
This package is [ESM only][esm].
In Node.js (version 12.20+, 14.14+, or 16.0+), install with [npm][]:
###### In
```sh
npm install remark-lint-no-literal-urls
```
```markdown
<http://foo.bar/baz>
In Deno with [Skypack][]:
```js
import remarkLintNoLiteralUrls from 'https://cdn.skypack.dev/remark-lint-no-literal-urls@3?dts'
```
###### Out
In browsers with [Skypack][]:
No messages.
```html
<script type="module">
import remarkLintNoLiteralUrls from 'https://cdn.skypack.dev/remark-lint-no-literal-urls@3?min'
</script>
```
##### `not-ok.md`
## Use
###### In
On the API:
Note: this example uses [GFM][].
```js
import {read} from 'to-vfile'
import {reporter} from 'vfile-reporter'
import {remark} from 'remark'
import remarkLint from 'remark-lint'
import remarkLintNoLiteralUrls from 'remark-lint-no-literal-urls'
```markdown
http://foo.bar/baz
```
main()
###### Out
async function main() {
const file = await remark()
.use(remarkLint)
.use(remarkLintNoLiteralUrls)
.process(await read('example.md'))
```text
1:1-1:19: Don’t use literal URLs without angle brackets
console.error(reporter(file))
}
```
## Install
On the CLI:
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-literal-urls
remark --use remark-lint --use remark-lint-no-literal-urls example.md
```
This package exports no identifiers.
The default export is `remarkLintNoLiteralUrls`.
On the CLI in a config file (here a `package.json`):
## Use
You probably want to use it on the CLI through a config file:
```diff

@@ -91,4 +111,4 @@

"lint",
+ "lint-no-literal-urls",
"remark-lint",
+ "remark-lint-no-literal-urls",

@@ -100,25 +120,63 @@ ]

Or use it on the CLI directly
## API
```sh
remark -u lint -u lint-no-literal-urls readme.md
This package exports no identifiers.
The default export is `remarkLintNoLiteralUrls`.
### `unified().use(remarkLintNoLiteralUrls[, config])`
This rule supports standard configuration that all remark lint rules accept
(such as `false` to turn it off or `[1, options]` to configure it).
There are no options.
## Recommendation
Autolink literal URLs (just a URL) are a feature enabled by GFM.
They don’t work everywhere.
Due to this, it’s recommended to instead use normal autolinks
(`<https://url>`) or links (`[text](url)`).
## Fix
[`remark-stringify`](https://github.com/remarkjs/remark/tree/main/packages/remark-stringify)
never creates autolink literals and always uses normal autolinks (`<url>`).
## Examples
##### `ok.md`
###### In
```markdown
<http://foo.bar/baz>
```
Or use this on the API:
###### Out
```diff
import {remark} from 'remark'
import {reporter} from 'vfile-reporter'
import remarkLint from 'remark-lint'
import remarkLintNoLiteralUrls from 'remark-lint-no-literal-urls'
No messages.
remark()
.use(remarkLint)
+ .use(remarkLintNoLiteralUrls)
.process('_Emphasis_ and **importance**')
.then((file) => {
console.error(reporter(file))
})
##### `not-ok.md`
###### In
> 👉 **Note**: this example uses GFM ([`remark-gfm`][gfm]).
```markdown
http://foo.bar/baz
```
###### Out
```text
1:1-1:19: Don’t use literal URLs without angle brackets
```
## Compatibility
Projects maintained by the unified collective are compatible with all maintained
versions of Node.js.
As of now, that is Node.js 12.20+, 14.14+, and 16.0+.
Our projects sometimes work with older versions, but this is not guaranteed.
## Contribute

@@ -164,4 +222,12 @@

[unified]: https://github.com/unifiedjs/unified
[remark]: https://github.com/remarkjs/remark
[mono]: https://github.com/remarkjs/remark-lint
[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
[skypack]: https://www.skypack.dev
[npm]: https://docs.npmjs.com/cli/install

@@ -171,7 +237,7 @@

[contributing]: https://github.com/remarkjs/.github/blob/HEAD/contributing.md
[contributing]: https://github.com/remarkjs/.github/blob/main/contributing.md
[support]: https://github.com/remarkjs/.github/blob/HEAD/support.md
[support]: https://github.com/remarkjs/.github/blob/main/support.md
[coc]: https://github.com/remarkjs/.github/blob/HEAD/code-of-conduct.md
[coc]: https://github.com/remarkjs/.github/blob/main/code-of-conduct.md

@@ -178,0 +244,0 @@ [license]: https://github.com/remarkjs/remark-lint/blob/main/license

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc