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

remark-lint-list-item-spacing

Package Overview
Dependencies
Maintainers
2
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

remark-lint-list-item-spacing - npm Package Compare versions

Comparing version 4.1.0 to 4.1.1

6

index.d.ts

@@ -10,5 +10,5 @@ export default remarkLintListItemSpacing

| [
| Options
| import('unified-lint-rule').Label
| import('unified-lint-rule').Severity
| import('unified-lint-rule').Label
| Options
| undefined

@@ -19,4 +19,4 @@ ]

| boolean
| import('unified-lint-rule').Label
| import('unified-lint-rule').Severity
| import('unified-lint-rule').Label
),

@@ -23,0 +23,0 @@ Options | undefined

/**
* @author Titus Wormer
* @copyright 2015 Titus Wormer
* @license MIT
* @module list-item-spacing
* @fileoverview
* Warn when list looseness is incorrect, such as being tight when it should
* be loose, and vice versa.
* ## When should I use this?
*
* According to the [`markdown-style-guide`](http://www.cirosantilli.com/markdown-style-guide/),
* if one or more list items in a list spans more than one line, the list is
* required to have blank lines between each item.
* And otherwise, there should not be blank lines between items.
* You can use this package to check that lists are loose or tight when
* they should be.
*
* By default, all items must be spread out (a blank line must be between
* them) if one or more items are multiline (span more than one line).
* Otherwise, the list must be tight (no blank line must be between items).
* ## API
*
* If you pass `{checkBlanks: true}`, all items must be spread out if one or
* more items contain blank lines.
* Otherwise, the list must be tight.
* The following options (default: `undefined`) are accepted:
*
* * `Object` with the following fields:
* * `checkBlanks` (`boolean`, default: `false`)
* — adhere to CommonMark looseness instead of markdown-style-guide
* preference
*
* ## Recommendation
*
* First, some background.
* There are two types of lists in markdown (other than ordered and unordered):
* tight and loose lists.
* Lists are tight by default but if there is a blank line between two list
* items or between two blocks inside an item, that turns the whole list into a
* loose list.
* When turning markdown into HTML, paragraphs in tight lists are not wrapped
* in `<p>` tags.
*
* This rule defaults to the
* [`markdown style guide`](https://cirosantilli.com/markdown-style-guide/)
* preference for which lists should be loose or not: loose when at least one
* item spans more than one line, tight otherwise.
* With `{checkBlanks: true}`, this rule dictates that when at least one item is
* loose, all items must be loose.
*
* @module list-item-spacing
* @summary
* remark-lint rule to warn when lists are loose when they should be tight,
* or vice versa.
* @author Titus Wormer
* @copyright 2015 Titus Wormer
* @license MIT
* @example

@@ -24,0 +42,0 @@ * {"name": "ok.md"}

{
"name": "remark-lint-list-item-spacing",
"version": "4.1.0",
"version": "4.1.1",
"description": "remark-lint rule to warn when list looseness is incorrect",

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

@@ -13,18 +13,31 @@ <!--This file is generated-->

Warn when list looseness is incorrect, such as being tight when it should
be loose, and vice versa.
[`remark-lint`][mono] rule to warn when lists are loose when they should be tight,
or vice versa.
According to the [`markdown-style-guide`](http://www.cirosantilli.com/markdown-style-guide/),
if one or more list items in a list spans more than one line, the list is
required to have blank lines between each item.
And otherwise, there should not be blank lines between items.
## Contents
By default, all items must be spread out (a blank line must be between
them) if one or more items are multiline (span more than one line).
Otherwise, the list must be tight (no blank line must be between items).
* [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(remarkLintListItemSpacing[, config])`](#unifieduseremarklintlistitemspacing-config)
* [Recommendation](#recommendation)
* [Examples](#examples)
* [Compatibility](#compatibility)
* [Contribute](#contribute)
* [License](#license)
If you pass `{checkBlanks: true}`, all items must be spread out if one or
more items contain blank lines.
Otherwise, the list must be tight.
## 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 lists are loose or tight when
they should be.
## Presets

@@ -38,4 +51,106 @@

## 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-list-item-spacing
```
In Deno with [Skypack][]:
```js
import remarkLintListItemSpacing from 'https://cdn.skypack.dev/remark-lint-list-item-spacing@4?dts'
```
In browsers with [Skypack][]:
```html
<script type="module">
import remarkLintListItemSpacing from 'https://cdn.skypack.dev/remark-lint-list-item-spacing@4?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 remarkLintListItemSpacing from 'remark-lint-list-item-spacing'
main()
async function main() {
const file = await remark()
.use(remarkLint)
.use(remarkLintListItemSpacing)
.process(await read('example.md'))
console.error(reporter(file))
}
```
On the CLI:
```sh
remark --use remark-lint --use remark-lint-list-item-spacing example.md
```
On the CLI in a config file (here a `package.json`):
```diff
"remarkConfig": {
"plugins": [
"remark-lint",
+ "remark-lint-list-item-spacing",
]
}
```
## API
This package exports no identifiers.
The default export is `remarkLintListItemSpacing`.
### `unified().use(remarkLintListItemSpacing[, 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: `undefined`) are accepted:
* `Object` with the following fields:
* `checkBlanks` (`boolean`, default: `false`)
— adhere to CommonMark looseness instead of markdown-style-guide
preference
## Recommendation
First, some background.
There are two types of lists in markdown (other than ordered and unordered):
tight and loose lists.
Lists are tight by default but if there is a blank line between two list
items or between two blocks inside an item, that turns the whole list into a
loose list.
When turning markdown into HTML, paragraphs in tight lists are not wrapped
in `<p>` tags.
This rule defaults to the
[`markdown style guide`](https://cirosantilli.com/markdown-style-guide/)
preference for which lists should be loose or not: loose when at least one
item spans more than one line, tight otherwise.
With `{checkBlanks: true}`, this rule dictates that when at least one item is
loose, all items must be loose.
## Examples
##### `ok.md`

@@ -159,56 +274,9 @@

## 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-list-item-spacing
```
This package exports no identifiers.
The default export is `remarkLintListItemSpacing`.
## Use
You probably want to use it on the CLI through a config file:
```diff
"remarkConfig": {
"plugins": [
"lint",
+ "lint-list-item-spacing",
]
}
```
Or use it on the CLI directly
```sh
remark -u lint -u lint-list-item-spacing readme.md
```
Or use this on the API:
```diff
import {remark} from 'remark'
import {reporter} from 'vfile-reporter'
import remarkLint from 'remark-lint'
import remarkLintListItemSpacing from 'remark-lint-list-item-spacing'
remark()
.use(remarkLint)
+ .use(remarkLintListItemSpacing)
.process('_Emphasis_ and **importance**')
.then((file) => {
console.error(reporter(file))
})
```
## Contribute

@@ -254,4 +322,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

@@ -261,7 +337,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

@@ -268,0 +344,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