Socket
Socket
Sign inDemoInstall

remark-lint-no-shortcut-reference-link

Package Overview
Dependencies
16
Maintainers
2
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.1.0 to 3.1.1

4

index.d.ts
export default remarkLintNoShortcutReferenceLink
export type Root = import('mdast').Root
declare const remarkLintNoShortcutReferenceLink: 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

/**
* ## When should I use this?
*
* You can use this package to check that collapsed or full reference links
* are used.
*
* ## API
*
* There are no options.
*
* ## Recommendation
*
* Shortcut references use an implicit style that looks a lot like something
* that could occur as plain text instead of syntax.
* In some cases, plain text is intended instead of a link.
* Due to this, it’s recommended to use collapsed (or full) references
* instead.
*
* @module no-shortcut-reference-link
* @summary
* remark-lint rule to warn when shortcut reference links are used.
* @author Titus Wormer
* @copyright 2015 Titus Wormer
* @license MIT
* @module no-shortcut-reference-link
* @fileoverview
* Warn when shortcut reference links are used.
*
* Shortcut references render as links when a definition is found, and as
* plain text without definition.
* Sometimes, you don’t intend to create a link from the reference, but this
* rule still warns anyway.
* In that case, you can escape the reference like so: `\[foo]`.
*
* @example

@@ -16,0 +26,0 @@ * {"name": "ok.md"}

{
"name": "remark-lint-no-shortcut-reference-link",
"version": "3.1.0",
"version": "3.1.1",
"description": "remark-lint rule to warn when shortcut reference links are used",

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

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

Warn when shortcut reference links are used.
[`remark-lint`][mono] rule to warn when shortcut reference links are used.
Shortcut references render as links when a definition is found, and as
plain text without definition.
Sometimes, you don’t intend to create a link from the reference, but this
rule still warns anyway.
In that case, you can escape the reference like so: `\[foo]`.
## Contents
* [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(remarkLintNoShortcutReferenceLink[, config])`](#unifieduseremarklintnoshortcutreferencelink-config)
* [Recommendation](#recommendation)
* [Examples](#examples)
* [Compatibility](#compatibility)
* [Contribute](#contribute)
* [License](#license)
## 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 collapsed or full reference links
are used.
## Presets

@@ -31,52 +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-shortcut-reference-link
```
```markdown
[foo][]
In Deno with [Skypack][]:
[foo]: http://foo.bar/baz
```js
import remarkLintNoShortcutReferenceLink from 'https://cdn.skypack.dev/remark-lint-no-shortcut-reference-link@3?dts'
```
###### Out
In browsers with [Skypack][]:
No messages.
```html
<script type="module">
import remarkLintNoShortcutReferenceLink from 'https://cdn.skypack.dev/remark-lint-no-shortcut-reference-link@3?min'
</script>
```
##### `not-ok.md`
## Use
###### In
On the API:
```markdown
[foo]
```js
import {read} from 'to-vfile'
import {reporter} from 'vfile-reporter'
import {remark} from 'remark'
import remarkLint from 'remark-lint'
import remarkLintNoShortcutReferenceLink from 'remark-lint-no-shortcut-reference-link'
[foo]: http://foo.bar/baz
```
main()
###### Out
async function main() {
const file = await remark()
.use(remarkLint)
.use(remarkLintNoShortcutReferenceLink)
.process(await read('example.md'))
```text
1:1-1:6: Use the trailing `[]` on reference links
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-shortcut-reference-link
remark --use remark-lint --use remark-lint-no-shortcut-reference-link example.md
```
This package exports no identifiers.
The default export is `remarkLintNoShortcutReferenceLink`.
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

@@ -87,4 +111,4 @@

"lint",
+ "lint-no-shortcut-reference-link",
"remark-lint",
+ "remark-lint-no-shortcut-reference-link",

@@ -96,25 +120,61 @@ ]

Or use it on the CLI directly
## API
```sh
remark -u lint -u lint-no-shortcut-reference-link readme.md
This package exports no identifiers.
The default export is `remarkLintNoShortcutReferenceLink`.
### `unified().use(remarkLintNoShortcutReferenceLink[, 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
Shortcut references use an implicit style that looks a lot like something
that could occur as plain text instead of syntax.
In some cases, plain text is intended instead of a link.
Due to this, it’s recommended to use collapsed (or full) references
instead.
## Examples
##### `ok.md`
###### In
```markdown
[foo][]
[foo]: 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 remarkLintNoShortcutReferenceLink from 'remark-lint-no-shortcut-reference-link'
No messages.
remark()
.use(remarkLint)
+ .use(remarkLintNoShortcutReferenceLink)
.process('_Emphasis_ and **importance**')
.then((file) => {
console.error(reporter(file))
})
##### `not-ok.md`
###### In
```markdown
[foo]
[foo]: http://foo.bar/baz
```
###### Out
```text
1:1-1:6: Use the trailing `[]` on reference links
```
## 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

@@ -160,4 +220,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

@@ -167,7 +235,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

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

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc