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

remark-lint-maximum-line-length

Package Overview
Dependencies
Maintainers
2
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

remark-lint-maximum-line-length - npm Package Compare versions

Comparing version 3.1.1 to 3.1.2

35

index.js
/**
* @author Titus Wormer
* @copyright 2015 Titus Wormer
* @license MIT
* @module maximum-line-length
* @fileoverview
* Warn when lines are too long.
* ## When should I use this?
*
* Options: `number`, default: `80`.
* You can use this package to check that lines do not exceed a certain size.
*
* Ignores nodes that cannot be wrapped, such as headings, tables, code,
* definitions, HTML, and JSX.
* ## API
*
* Ignores images, links, and inline code if they start before the wrap, end
* after the wrap, and there’s no whitespace after them.
* The following options (default: `80`) are accepted:
*
* * `number` (example: `72`)
* — max number of characters to accept in heading text
*
* Ignores nodes that cannot be wrapped, such as headings, tables, code,
* definitions, HTML, and JSX.
* Ignores images, links, and code (inline) if they start before the wrap, end
* after the wrap, and there’s no white space after them.
*
* ## Recommendation
*
* Whether to wrap prose or not is a stylistic choice.
*
* @module maximum-line-length
* @summary
* remark-lint rule to warn when lines are too long.
* @author Titus Wormer
* @copyright 2015 Titus Wormer
* @license MIT
* @example

@@ -41,3 +52,3 @@ * {"name": "ok.md", "positionless": true, "gfm": true}

*
* The following is also fine, because there is no whitespace.
* The following is also fine (note the `.`), because there is no whitespace.
*

@@ -44,0 +55,0 @@ * <http://this-long-url-with-a-long-domain-is-ok.co.uk/a-long-path?query=variables>.

{
"name": "remark-lint-maximum-line-length",
"version": "3.1.1",
"version": "3.1.2",
"description": "remark-lint rule to warn when lines are too long",

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

@@ -13,12 +13,29 @@ <!--This file is generated-->

Warn when lines are too long.
[`remark-lint`][mono] rule to warn when lines are too long.
Options: `number`, default: `80`.
## Contents
Ignores nodes that cannot be wrapped, such as headings, tables, code,
definitions, HTML, and JSX.
* [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(remarkLintMaximumLineLength[, config])`](#unifieduseremarklintmaximumlinelength-config)
* [Recommendation](#recommendation)
* [Examples](#examples)
* [Compatibility](#compatibility)
* [Contribute](#contribute)
* [License](#license)
Ignores images, links, and inline code if they start before the wrap, end
after the wrap, and there’s no whitespace after them.
## 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 lines do not exceed a certain size.
## Presets

@@ -32,4 +49,95 @@

## Example
## Install
This package is [ESM only][esm].
In Node.js (version 12.20+, 14.14+, or 16.0+), install with [npm][]:
```sh
npm install remark-lint-maximum-line-length
```
In Deno with [Skypack][]:
```js
import remarkLintMaximumLineLength from 'https://cdn.skypack.dev/remark-lint-maximum-line-length@3?dts'
```
In browsers with [Skypack][]:
```html
<script type="module">
import remarkLintMaximumLineLength from 'https://cdn.skypack.dev/remark-lint-maximum-line-length@3?min'
</script>
```
## Use
On the API:
```js
import {read} from 'to-vfile'
import {reporter} from 'vfile-reporter'
import {remark} from 'remark'
import remarkLint from 'remark-lint'
import remarkLintMaximumLineLength from 'remark-lint-maximum-line-length'
main()
async function main() {
const file = await remark()
.use(remarkLint)
.use(remarkLintMaximumLineLength)
.process(await read('example.md'))
console.error(reporter(file))
}
```
On the CLI:
```sh
remark --use remark-lint --use remark-lint-maximum-line-length example.md
```
On the CLI in a config file (here a `package.json`):
```diff
"remarkConfig": {
"plugins": [
"remark-lint",
+ "remark-lint-maximum-line-length",
]
}
```
## API
This package exports no identifiers.
The default export is `remarkLintMaximumLineLength`.
### `unified().use(remarkLintMaximumLineLength[, 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).
The following options (default: `80`) are accepted:
* `number` (example: `72`)
— max number of characters to accept in heading text
Ignores nodes that cannot be wrapped, such as headings, tables, code,
definitions, HTML, and JSX.
Ignores images, links, and code (inline) if they start before the wrap, end
after the wrap, and there’s no white space after them.
## Recommendation
Whether to wrap prose or not is a stylistic choice.
## Examples
##### `ok-mixed-line-endings.md`

@@ -41,5 +149,5 @@

Note: `␍␊` represents a carriage return and a line feed.
> 👉 **Note**: `␍␊` represents a carriage return and a line feed.
Note: `␊` represents a line feed.
> 👉 **Note**: `␊` represents a line feed.

@@ -63,5 +171,5 @@ ```markdown

Note: `␍␊` represents a carriage return and a line feed.
> 👉 **Note**: `␍␊` represents a carriage return and a line feed.
Note: `␊` represents a line feed.
> 👉 **Note**: `␊` represents a line feed.

@@ -119,3 +227,3 @@ ```markdown

Note: this example uses [GFM][].
> 👉 **Note**: this example uses GFM ([`remark-gfm`][gfm]).

@@ -144,3 +252,3 @@ ```markdown

The following is also fine, because there is no whitespace.
The following is also fine (note the `.`), because there is no whitespace.

@@ -158,56 +266,9 @@ <http://this-long-url-with-a-long-domain-is-ok.co.uk/a-long-path?query=variables>.

## Install
## Compatibility
This package is [ESM only][esm]:
Node 12+ is needed to use it and it must be `imported`ed instead of `required`d.
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.
[npm][]:
```sh
npm install remark-lint-maximum-line-length
```
This package exports no identifiers.
The default export is `remarkLintMaximumLineLength`.
## Use
You probably want to use it on the CLI through a config file:
```diff
"remarkConfig": {
"plugins": [
"lint",
+ "lint-maximum-line-length",
]
}
```
Or use it on the CLI directly
```sh
remark -u lint -u lint-maximum-line-length readme.md
```
Or use this on the API:
```diff
import {remark} from 'remark'
import {reporter} from 'vfile-reporter'
import remarkLint from 'remark-lint'
import remarkLintMaximumLineLength from 'remark-lint-maximum-line-length'
remark()
.use(remarkLint)
+ .use(remarkLintMaximumLineLength)
.process('_Emphasis_ and **importance**')
.then((file) => {
console.error(reporter(file))
})
```
## Contribute

@@ -253,4 +314,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

@@ -260,7 +329,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

@@ -267,0 +336,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