JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 147168
  • Score
    100M100P100Q184623F
  • License MIT

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

Package Exports

  • remark-lint-checkbox-character-style

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (remark-lint-checkbox-character-style) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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:

Preset Setting
remark-preset-lint-consistent 'consistent'

Example

ok.md

When configured with { checked: 'x' }.

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

No messages.

ok.md

When configured with { checked: 'X' }.

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

No messages.

ok.md

When configured with { unchecked: ' ' }.

In

Note: · represents a space.

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

No messages.

ok.md

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

In

Note: » represents a tab.

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

No messages.

not-ok.md
In

Note: » represents a tab.

- [x] List item
- [X] List item
- [ ] List item
- [»] List item
Out
2:4-2:5: Checked checkboxes should use `x` as a marker
4:4-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

npm:

npm install remark-lint-checkbox-character-style

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:

 var remark = require('remark')
 var report = require('vfile-reporter')

 remark()
   .use(require('remark-lint'))
+  .use(require('remark-lint-checkbox-character-style'))
   .process('_Emphasis_ and **importance**', function (err, file) {
     console.error(report(err || 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