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

remark-lint rule to warn when list looseness is incorrect

  • 4.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
77K
decreased by-9.1%
Maintainers
2
Weekly downloads
 
Created
Source

remark-lint-list-item-spacing

Build Coverage Downloads Size Sponsors Backers Chat

Warn when list looseness is incorrect, such as being tight when it should be loose, and vice versa.

According to the 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.

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).

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.

Presets

This rule is included in the following presets:

PresetSetting
remark-preset-lint-markdown-style-guide

Example

ok.md
In
A tight list:

-   item 1
-   item 2
-   item 3

A loose list:

-   Wrapped
    item

-   item 2

-   item 3
Out

No messages.

not-ok.md
In
A tight list:

-   Wrapped
    item
-   item 2
-   item 3

A loose list:

-   item 1

-   item 2

-   item 3
Out
4:9-5:1: Missing new line after list item
5:11-6:1: Missing new line after list item
10:11-12:1: Extraneous new line after list item
12:11-14:1: Extraneous new line after list item
ok.md

When configured with { checkBlanks: true }.

In
A tight list:

-   item 1
    - item 1.A
-   item 2
    > Block quote

A loose list:

-   item 1

    - item 1.A

-   item 2

    > Block quote
Out

No messages.

not-ok.md

When configured with { checkBlanks: true }.

In
A tight list:

-   item 1

    - item 1.A
-   item 2

    > Block quote
-   item 3

A loose list:

-   item 1
    - item 1.A

-   item 2
    > Block quote
Out
5:15-6:1: Missing new line after list item
8:18-9:1: Missing new line after list item
14:15-16:1: Extraneous new line after list item

Install

This package is ESM only: Node 12+ is needed to use it and it must be importeded instead of requiredd.

npm:

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:

 …
 "remarkConfig": {
   "plugins": [
     …
     "lint",
+    "lint-list-item-spacing",
     …
   ]
 }
 …

Or use it on the CLI directly

remark -u lint -u lint-list-item-spacing readme.md

Or use this on the API:

 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

See contributing.md in remarkjs/.github for ways to get started. See support.md for ways to get help.

This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.

License

MIT © Titus Wormer

Keywords

FAQs

Package last updated on 12 Aug 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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