remark-lint-unordered-list-marker-style
Advanced tools
Comparing version 3.1.0 to 3.1.1
@@ -8,5 +8,5 @@ export default remarkLintUnorderedListMarkerStyle | ||
| [ | ||
| Options | ||
| import('unified-lint-rule').Label | ||
| import('unified-lint-rule').Severity | ||
| import('unified-lint-rule').Label | ||
| Options | ||
| undefined | ||
@@ -17,4 +17,4 @@ ] | ||
| boolean | ||
| import('unified-lint-rule').Label | ||
| import('unified-lint-rule').Severity | ||
| import('unified-lint-rule').Label | ||
), | ||
@@ -21,0 +21,0 @@ Options | undefined |
50
index.js
/** | ||
* @author Titus Wormer | ||
* @copyright 2015 Titus Wormer | ||
* @license MIT | ||
* @module unordered-list-marker-style | ||
* @fileoverview | ||
* Warn when the list item marker style of unordered lists violate a given | ||
* style. | ||
* ## When should I use this? | ||
* | ||
* Options: `'consistent'`, `'-'`, `'*'`, or `'+'`, default: `'consistent'`. | ||
* You can use this package to check that unordered list markers (bullets) | ||
* are consistent. | ||
* | ||
* `'consistent'` detects the first used list style and warns when subsequent | ||
* lists use different styles. | ||
* ## API | ||
* | ||
* ## Fix | ||
* The following options (default: `'consistent'`) are accepted: | ||
* | ||
* [`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify) | ||
* formats unordered lists using `-` (hyphen-minus) by default. | ||
* Pass | ||
* [`bullet: '*'` or `bullet: '+'`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify#optionsbullet) | ||
* to use `*` (asterisk) or `+` (plus sign) instead. | ||
* * `'*'` | ||
* — prefer asterisks | ||
* * `'+'` | ||
* — prefer plusses | ||
* * `'-'` | ||
* — prefer dashes | ||
* * `'consistent'` | ||
* — detect the first used style and warn when further markers differ | ||
* | ||
* See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) | ||
* on how to automatically fix warnings for this rule. | ||
* ## Recommendation | ||
* | ||
* Because asterisks can be used as a marker for more markdown constructs, | ||
* it’s recommended to use that for lists (and thematic breaks, emphasis, | ||
* strong) too. | ||
* | ||
* ## Fix | ||
* | ||
* [`remark-stringify`](https://github.com/remarkjs/remark/tree/main/packages/remark-stringify) | ||
* formats ordered lists with asterisks by default. | ||
* Pass | ||
* [`bullet: '+'` or `bullet: '-'`](https://github.com/remarkjs/remark/tree/main/packages/remark-stringify#optionsbullet) | ||
* to always use plusses or dashes. | ||
* | ||
* @module unordered-list-marker-style | ||
* @summary | ||
* remark-lint rule to warn when unordered list markers are inconsistent. | ||
* @author Titus Wormer | ||
* @copyright 2015 Titus Wormer | ||
* @license MIT | ||
* @example | ||
@@ -27,0 +41,0 @@ * {"name": "ok.md"} |
{ | ||
"name": "remark-lint-unordered-list-marker-style", | ||
"version": "3.1.0", | ||
"version": "3.1.1", | ||
"description": "remark-lint rule to warn when markers of unordered lists violate a given style", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
211
readme.md
@@ -13,21 +13,31 @@ <!--This file is generated--> | ||
Warn when the list item marker style of unordered lists violate a given | ||
style. | ||
[`remark-lint`][mono] rule to warn when unordered list markers are inconsistent. | ||
Options: `'consistent'`, `'-'`, `'*'`, or `'+'`, default: `'consistent'`. | ||
## Contents | ||
`'consistent'` detects the first used list style and warns when subsequent | ||
lists use different styles. | ||
* [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(remarkLintUnorderedListMarkerStyle[, config])`](#unifieduseremarklintunorderedlistmarkerstyle-config) | ||
* [Recommendation](#recommendation) | ||
* [Fix](#fix) | ||
* [Examples](#examples) | ||
* [Compatibility](#compatibility) | ||
* [Contribute](#contribute) | ||
* [License](#license) | ||
## Fix | ||
## What is this? | ||
[`remark-stringify`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify) | ||
formats unordered lists using `-` (hyphen-minus) by default. | ||
Pass | ||
[`bullet: '*'` or `bullet: '+'`](https://github.com/remarkjs/remark/tree/HEAD/packages/remark-stringify#optionsbullet) | ||
to use `*` (asterisk) or `+` (plus sign) instead. | ||
This package is a [unified][] ([remark][]) plugin, specifically a `remark-lint` | ||
rule. | ||
Lint rules check markdown code style. | ||
See [Using remark to fix your Markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown) | ||
on how to automatically fix warnings for this rule. | ||
## When should I use this? | ||
You can use this package to check that unordered list markers (bullets) | ||
are consistent. | ||
## Presets | ||
@@ -41,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-unordered-list-marker-style | ||
``` | ||
In Deno with [Skypack][]: | ||
```js | ||
import remarkLintUnorderedListMarkerStyle from 'https://cdn.skypack.dev/remark-lint-unordered-list-marker-style@3?dts' | ||
``` | ||
In browsers with [Skypack][]: | ||
```html | ||
<script type="module"> | ||
import remarkLintUnorderedListMarkerStyle from 'https://cdn.skypack.dev/remark-lint-unordered-list-marker-style@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 remarkLintUnorderedListMarkerStyle from 'remark-lint-unordered-list-marker-style' | ||
main() | ||
async function main() { | ||
const file = await remark() | ||
.use(remarkLint) | ||
.use(remarkLintUnorderedListMarkerStyle) | ||
.process(await read('example.md')) | ||
console.error(reporter(file)) | ||
} | ||
``` | ||
On the CLI: | ||
```sh | ||
remark --use remark-lint --use remark-lint-unordered-list-marker-style example.md | ||
``` | ||
On the CLI in a config file (here a `package.json`): | ||
```diff | ||
… | ||
"remarkConfig": { | ||
"plugins": [ | ||
… | ||
"remark-lint", | ||
+ "remark-lint-unordered-list-marker-style", | ||
… | ||
] | ||
} | ||
… | ||
``` | ||
## API | ||
This package exports no identifiers. | ||
The default export is `remarkLintUnorderedListMarkerStyle`. | ||
### `unified().use(remarkLintUnorderedListMarkerStyle[, 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: `'consistent'`) are accepted: | ||
* `'*'` | ||
— prefer asterisks | ||
* `'+'` | ||
— prefer plusses | ||
* `'-'` | ||
— prefer dashes | ||
* `'consistent'` | ||
— detect the first used style and warn when further markers differ | ||
## Recommendation | ||
Because asterisks can be used as a marker for more markdown constructs, | ||
it’s recommended to use that for lists (and thematic breaks, emphasis, | ||
strong) too. | ||
## Fix | ||
[`remark-stringify`](https://github.com/remarkjs/remark/tree/main/packages/remark-stringify) | ||
formats ordered lists with asterisks by default. | ||
Pass | ||
[`bullet: '+'` or `bullet: '-'`](https://github.com/remarkjs/remark/tree/main/packages/remark-stringify#optionsbullet) | ||
to always use plusses or dashes. | ||
## Examples | ||
##### `ok.md` | ||
@@ -136,56 +248,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-unordered-list-marker-style | ||
``` | ||
This package exports no identifiers. | ||
The default export is `remarkLintUnorderedListMarkerStyle`. | ||
## Use | ||
You probably want to use it on the CLI through a config file: | ||
```diff | ||
… | ||
"remarkConfig": { | ||
"plugins": [ | ||
… | ||
"lint", | ||
+ "lint-unordered-list-marker-style", | ||
… | ||
] | ||
} | ||
… | ||
``` | ||
Or use it on the CLI directly | ||
```sh | ||
remark -u lint -u lint-unordered-list-marker-style readme.md | ||
``` | ||
Or use this on the API: | ||
```diff | ||
import {remark} from 'remark' | ||
import {reporter} from 'vfile-reporter' | ||
import remarkLint from 'remark-lint' | ||
import remarkLintUnorderedListMarkerStyle from 'remark-lint-unordered-list-marker-style' | ||
remark() | ||
.use(remarkLint) | ||
+ .use(remarkLintUnorderedListMarkerStyle) | ||
.process('_Emphasis_ and **importance**') | ||
.then((file) => { | ||
console.error(reporter(file)) | ||
}) | ||
``` | ||
## Contribute | ||
@@ -231,4 +296,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 | ||
@@ -238,7 +311,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 | ||
@@ -245,0 +318,0 @@ [license]: https://github.com/remarkjs/remark-lint/blob/main/license |
12622
162
316