Socket
Socket
Sign inDemoInstall

remark-lint-checkbox-character-style

Package Overview
Dependencies
16
Maintainers
2
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    remark-lint-checkbox-character-style

remark-lint rule to warn when list item checkboxes violate a given style


Version published
Maintainers
2
Install size
323 kB
Created

Readme

Source

remark-lint-checkbox-character-style

Build Coverage Downloads Size Sponsors Backers Chat

Warn when list item checkboxes violate a given style.

Options: Object or 'consistent', default: 'consistent'.

'consistent' detects the first used checked and unchecked checkbox styles and warns when subsequent checkboxes use different styles.

Styles can also be passed in like so:

{checked: 'x', unchecked: ' '}

Fix

remark-stringify formats checked checkboxes using x (lowercase X) and unchecked checkboxes as · (a single space).

See Using remark to fix your Markdown on how to automatically fix warnings for this rule.

Presets

This rule is included in the following presets:

PresetSetting
remark-preset-lint-consistent'consistent'

Example

ok.md

When configured with { checked: 'x' }.

In

Note: this example uses GFM.

- [x] List item
- [x] List item
Out

No messages.

ok.md

When configured with { checked: 'X' }.

In

Note: this example uses GFM.

- [X] List item
- [X] List item
Out

No messages.

ok.md

When configured with { unchecked: ' ' }.

In

Note: this example uses GFM.

Note: · represents a space.

- [ ] List item
- [ ] List item
- [ ]··
- [ ]
Out

No messages.

ok.md

When configured with { unchecked: '\t' }.

In

Note: this example uses GFM.

Note: » represents a tab.

- [»] List item
- [»] List item
Out

No messages.

not-ok.md
In

Note: this example uses GFM.

Note: » represents a tab.

- [x] List item
- [X] List item
- [ ] List item
- [»] List item
Out
2:5: Checked checkboxes should use `x` as a marker
4:5: Unchecked checkboxes should use ` ` as a marker
not-ok.md

When configured with { unchecked: '💩' }.

Out
1:1: Incorrect unchecked checkbox marker `💩`: use either `'\t'`, or `' '`
not-ok.md

When configured with { checked: '💩' }.

Out
1:1: Incorrect checked checkbox marker `💩`: use either `'x'`, or `'X'`

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-checkbox-character-style

This package exports no identifiers. The default export is remarkLintCheckboxCharacterStyle.

Use

You probably want to use it on the CLI through a config file:

 …
 "remarkConfig": {
   "plugins": [
     …
     "lint",
+    "lint-checkbox-character-style",
     …
   ]
 }
 …

Or use it on the CLI directly

remark -u lint -u lint-checkbox-character-style readme.md

Or use this on the API:

 import {remark} from 'remark'
 import {reporter} from 'vfile-reporter'
 import remarkLint from 'remark-lint'
 import remarkLintCheckboxCharacterStyle from 'remark-lint-checkbox-character-style'

 remark()
   .use(remarkLint)
+  .use(remarkLintCheckboxCharacterStyle)
   .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

Last updated on 17 Aug 2021

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc