Socket
Socket
Sign inDemoInstall

remark-lint-ordered-list-marker-value

Package Overview
Dependencies
20
Maintainers
3
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.1.2 to 4.0.0

index.d.ts.map

35

index.d.ts

@@ -1,23 +0,16 @@

export default remarkLintOrderedListMarkerValue
export type Root = import('mdast').Root
export default remarkLintOrderedListMarkerValue;
export type Nodes = import('mdast').Nodes;
export type Root = import('mdast').Root;
/**
* Options.
* Configuration.
*/
export type Options = 'single' | 'one' | 'ordered'
declare const remarkLintOrderedListMarkerValue: import('unified').Plugin<
| void[]
| [
| Options
| [
(
| boolean
| import('unified-lint-rule/lib/index.js').Label
| import('unified-lint-rule/lib/index.js').Severity
),
(Options | undefined)?
]
| undefined
],
import('mdast').Root,
import('mdast').Root
>
export type Options = Style | 'consistent';
/**
* Counter style.
*/
export type Style = 'one' | 'ordered' | 'single';
declare const remarkLintOrderedListMarkerValue: {
(config?: import("../../node_modules/unified-lint-rule/lib/index.js").Label | import("../../node_modules/unified-lint-rule/lib/index.js").Severity | Options | [level: import("../../node_modules/unified-lint-rule/lib/index.js").Label | import("../../node_modules/unified-lint-rule/lib/index.js").Severity, option?: Options | null | undefined] | null | undefined): ((tree: import("mdast").Root, file: import("vfile").VFile, next: import("unified").TransformCallback<import("mdast").Root>) => undefined) | undefined;
readonly name: string;
};
//# sourceMappingURL=index.d.ts.map

427

index.js
/**
* remark-lint rule to warn when ordered list values are inconsistent.
*
* ## What is this?
*
* This package checks ordered list values.
*
* ## When should I use this?
*
* You can use this package to check that ordered list values are consistent.
* You can use this package to check ordered lists.
*
* ## API
*
* The following options (default: `'ordered'`) are accepted:
* ### `unified().use(remarkLintOrderedListMarkerValue[, options])`
*
* * `'ordered'`
* — values should increment by one from the first item
* * `'single'`
* — values should stay the same as the first item
* * `'one'`
* — values should always be exactly `1`
* Warn when ordered list values are inconsistent.
*
* ###### Parameters
*
* * `options` ([`Options`][api-options], default: `'consistent'`)
* — preferred style
*
* ###### Returns
*
* Transform ([`Transformer` from `unified`][github-unified-transformer]).
*
* ### `Options`
*
* Configuration (TypeScript type).
*
* `consistent` looks at the first list with two or more items, and
* infer `'single'` if both are the same, and `'ordered'` otherwise.
*
* ###### Type
*
* ```ts
* type Options = Style | 'consistent'
* ```
*
* ### `Style`
*
* Counter style (TypeScript type).
*
* * `'one'`
* — values should always be exactly `1`
* * `'ordered'`
* — values should increment by one from the first item
* * `'single'`
* — values should stay the same as the first item
*
* ###### Type
*
* ```ts
* type Style = 'one' | 'ordered' | 'single'
* ```
*
* ## Recommendation
*
* While `'single'` might be the smartest style, as it makes it easier to move
* items around without having to renumber everything and doesn’t have
* problems with aligning content of the 9th and the 10th item, it’s not used a
* lot and arguably looks unnatural.
* While `'single'` might be the smartest style,
* as it makes it easier to move items around without having to renumber
* everything and doesn’t have problems with aligning content of the 9th and
* the 10th item,
* it’s not used a lot and arguably looks unnatural.
* `'one'` is like `'single'` but forces every list to start at `1`.
* While not often needed, starting lists at other values is sometimes useful.
* Due to this, `'ordered'` is recommended, although `'single'` is also a viable
* choice.
* While not often needed,
* starting lists at other values is sometimes useful.
* So `'ordered'` is recommended,
* although `'single'` is also a viable choice.
*
* ## Fix
*
* [`remark-stringify`](https://github.com/remarkjs/remark/tree/main/packages/remark-stringify)
* retains the value of the first item and increments further items by default.
* Pass
* [`incrementListMarker: false`](https://github.com/remarkjs/remark/tree/main/packages/remark-stringify#optionsincrementlistmarker)
* to not increment further items.
* [`remark-stringify`][github-remark-stringify] retains the value of the first
* item and increments further items by default.
* Pass `incrementListMarker: false` to not increment further items.
*
* [api-options]: #options
* [api-style]: #style
* [api-remark-lint-ordered-list-marker-value]: #unifieduseremarklintorderedlistmarkervalue-options
* [github-remark-stringify]: https://github.com/remarkjs/remark/tree/main/packages/remark-stringify
* [github-unified-transformer]: https://github.com/unifiedjs/unified#transformer
*
* @module ordered-list-marker-value
* @summary
* remark-lint rule to warn when ordered list values are inconsistent.
* @author Titus Wormer
* @copyright 2015 Titus Wormer
* @license MIT
*
* @example
* {"name": "ok.md"}
*
* The default value is `ordered`, so unless changed, the below
* is OK.
* 1. Mercury
* 2. Venus
*
* 1. Foo
* 2. Bar
* 3. Baz
* ***
*
* Paragraph.
* 3. Earth
* 4. Mars
*
* 3. Alpha
* 4. Bravo
* 5. Charlie
* ***
*
* Unordered lists are not affected by this rule.
* * Jupiter
*
* * Anton
*
* @example
* {"name": "ok.md", "config": "one"}
* {"name": "ok-infer-single.md"}
*
* 1. Foo
* 1. Bar
* 1. Baz
* 2. Mercury
* 2. Venus
*
* Paragraph.
* ***
*
* 1. Alpha
* 1. Bravo
* 1. Charlie
* 3. Earth
* 3. Mars
*
* @example
* {"name": "ok.md", "config": "single"}
* {"label": "input", "name": "nok-chaotic.md"}
*
* 1. Foo
* 1. Bar
* 1. Baz
* 2. Mercury
* 1. Venus
*
* Paragraph.
* ***
*
* 3. Alpha
* 3. Bravo
* 3. Charlie
* 1. Earth
* 1. Mars
* @example
* {"label": "output", "name": "nok-chaotic.md"}
*
* Paragraph.
* 2:2: Unexpected ordered list item value `1`, expected `3`
* 7:2: Unexpected ordered list item value `1`, expected `2`
*
* 0. Delta
* 0. Echo
* 0. Foxtrot
* @example
* {"config": "one", "name": "ok.md"}
*
* 1. Mercury
* 1. Venus
*
* @example
* {"name": "ok.md", "config": "ordered"}
*
* 1. Foo
* 2. Bar
* 3. Baz
* 1. Mercury
* 2. Venus
*
* Paragraph.
* ***
*
* 3. Alpha
* 4. Bravo
* 5. Charlie
* 3. Earth
* 4. Mars
*
* Paragraph.
* ***
*
* 0. Delta
* 1. Echo
* 2. Foxtrot
* 0. Jupiter
* 1. Saturn
*
* @example
* {"name": "not-ok.md", "config": "one", "label": "input"}
* {"config": "single", "name": "ok.md"}
*
* 1. Foo
* 2. Bar
* 1. Mercury
* 1. Venus
*
* ***
*
* 3. Earth
* 3. Mars
*
* ***
*
* 0. Jupiter
* 0. Saturn
*
* @example
* {"name": "not-ok.md", "config": "one", "label": "output"}
* {"config": "one", "label": "input", "name": "not-ok.md"}
*
* 2:1-2:8: Marker should be `1`, was `2`
* 1. Mercury
* 2. Venus
*
* ***
*
* 3. Earth
*
* ***
*
* 2. Mars
* 1. Jupiter
* @example
* {"name": "also-not-ok.md", "config": "one", "label": "input"}
* {"config": "one", "label": "output", "name": "not-ok.md"}
*
* 2. Foo
* 1. Bar
* 2:2: Unexpected ordered list item value `2`, expected `1`
* 6:2: Unexpected ordered list item value `3`, expected `1`
* 10:2: Unexpected ordered list item value `2`, expected `1`
*
* @example
* {"name": "also-not-ok.md", "config": "one", "label": "output"}
* {"config": "ordered", "label": "input", "name": "not-ok.md"}
*
* 1:1-1:8: Marker should be `1`, was `2`
* 1. Mercury
* 1. Venus
*
* ***
*
* 2. Mars
* 1. Jupiter
* @example
* {"name": "not-ok.md", "config": "ordered", "label": "input"}
* {"config": "ordered", "label": "output", "name": "not-ok.md"}
*
* 1. Foo
* 1. Bar
* 2:2: Unexpected ordered list item value `1`, expected `2`
* 7:2: Unexpected ordered list item value `1`, expected `3`
*
* @example
* {"name": "not-ok.md", "config": "ordered", "label": "output"}
* {"config": "single", "label": "input", "name": "not-ok.md"}
*
* 2:1-2:8: Marker should be `2`, was `1`
* 1. Mercury
* 2. Venus
*
* ***
*
* 2. Mars
* 1. Jupiter
* @example
* {"name": "not-ok.md", "config": "💩", "label": "output", "positionless": true}
* {"config": "single", "label": "output", "name": "not-ok.md"}
*
* 1:1: Incorrect ordered list item marker value `💩`: use either `'ordered'`, `'one'`, or `'single'`
* 2:2: Unexpected ordered list item value `2`, expected `1`
* 7:2: Unexpected ordered list item value `1`, expected `2`
*
* @example
* {"name": "not-ok.md", "config": "🌍", "label": "output", "positionless": true}
*
* 1:1: Unexpected value `🌍` for `options`, expected `'one'`, `'ordered'`, `'single'`, or `'consistent'`
*/
/**
* @typedef {import('mdast').Nodes} Nodes
* @typedef {import('mdast').Root} Root

@@ -157,10 +232,16 @@ */

/**
* @typedef {'single' | 'one' | 'ordered'} Options
* Options.
*/
* @typedef {Style | 'consistent'} Options
* Configuration.
* @typedef {'one' | 'ordered' | 'single'} Style
* Counter style.
*/
import {ok as assert} from 'devlop'
import {phrasing} from 'mdast-util-phrasing'
import {asciiDigit} from 'micromark-util-character'
import {lintRule} from 'unified-lint-rule'
import {visit} from 'unist-util-visit'
import {pointStart} from 'unist-util-position'
import {generated} from 'unist-util-generated'
import {SKIP, visitParents} from 'unist-util-visit-parents'
import {VFileMessage} from 'vfile-message'

@@ -172,54 +253,162 @@ const remarkLintOrderedListMarkerValue = lintRule(

},
/** @type {import('unified-lint-rule').Rule<Root, Options>} */
(tree, file, option = 'ordered') => {
/**
* @param {Root} tree
* Tree.
* @param {Options | null | undefined} [options='consistent']
* Configuration (default: `'consistent'`).
* @returns {undefined}
* Nothing.
*/
function (tree, file, options) {
const value = String(file)
/** @type {Style | undefined} */
let style
/** @type {VFileMessage | undefined} */
let cause
if (option !== 'ordered' && option !== 'one' && option !== 'single') {
if (options === null || options === undefined || options === 'consistent') {
// Empty.
} else if (
options === 'one' ||
options === 'ordered' ||
options === 'single'
) {
style = options
} else {
file.fail(
'Incorrect ordered list item marker value `' +
option +
"`: use either `'ordered'`, `'one'`, or `'single'`"
'Unexpected value `' +
options +
"` for `options`, expected `'one'`, `'ordered'`, `'single'`, or `'consistent'`"
)
}
visit(tree, 'list', (node) => {
/** @type {Array<{ancestors: Array<Nodes>, counters: Array<string | undefined>}>} */
const lists = []
visitParents(tree, function (node, parents) {
// Do not walk into phrasing.
if (phrasing(node)) {
return SKIP
}
if (node.type !== 'list') return
if (!node.ordered) return
let expected =
option === 'one' || node.start === null || node.start === undefined
? 1
: node.start
let index = -1
/** @type {Array<string | undefined>} */
const values = []
while (++index < node.children.length) {
const child = node.children[index]
for (const item of node.children) {
const start = pointStart(item)
/** @type {string | undefined} */
let counter
// Ignore generated nodes, first items.
if (generated(child) || (index === 0 && option !== 'one')) {
continue
if (start && typeof start.offset === 'number') {
let index = start.offset
let code = value.charCodeAt(index)
while (asciiDigit(code)) {
index++
code = value.charCodeAt(index)
}
counter = value.slice(start.offset, index)
}
// Increase the expected line number when in `ordered` mode.
if (option === 'ordered') {
expected++
values.push(counter)
}
lists.push({ancestors: [...parents, node], counters: values})
})
// Infer style.
if (!style) {
for (const info of lists) {
// Could be `undefined` for short lists *or* w/o positional info.
const [first, second] = info.counters
if (first && second) {
const inferredStyle =
second === String(Number(first) + 1)
? 'ordered'
: second === first
? 'single'
: undefined
if (inferredStyle) {
const node = info.ancestors.at(-1)
assert(node) // Always defined.
assert(node.type === 'list') // Always list.
style = inferredStyle
cause = new VFileMessage(
'Ordered list marker style `' +
style +
"` first defined for `'consistent'` here",
{
ancestors: info.ancestors,
place: node.position,
ruleId: 'ordered-list-marker-value',
source: 'remark-lint'
}
)
}
break
}
}
}
const marker = Number(
value
.slice(
pointStart(child).offset,
pointStart(child.children[0]).offset
)
.replace(/[\s.)]/g, '')
.replace(/\[[x ]?]\s*$/i, '')
if (!style) {
style = 'ordered'
cause = new VFileMessage(
"Ordered list marker style `ordered` assumed for `'consistent'`",
{ruleId: 'ordered-list-marker-value', source: 'remark-lint'}
)
}
for (const info of lists) {
const startValue = style === 'one' ? 1 : info.counters[0]
const node = info.ancestors.at(-1)
assert(node) // Always defined.
assert(node.type === 'list') // Always list.
// No positional info on first item.
if (!startValue) continue
const start = Number(startValue)
let index = -1
while (++index < info.counters.length) {
const item = node.children[index]
const actual = info.counters[index]
if (!actual) continue
const startPoint = pointStart(item)
assert(startPoint) // Always defined, we checked when we found items.
assert(typeof startPoint.offset === 'number') // Same.
const expected = String(
style === 'one' ? 1 : style === 'single' ? start : start + index
)
if (marker !== expected) {
if (actual !== expected) {
file.message(
'Marker should be `' + expected + '`, was `' + marker + '`',
child
'Unexpected ordered list item value `' +
actual +
'`, expected `' +
expected +
'`',
{
ancestors: [...info.ancestors, item],
cause,
place: {
line: startPoint.line,
column: startPoint.column + actual.length,
offset: startPoint.offset + actual.length
}
}
)
}
}
})
}
}

@@ -226,0 +415,0 @@ )

{
"name": "remark-lint-ordered-list-marker-value",
"version": "3.1.2",
"version": "4.0.0",
"description": "remark-lint rule to warn when the marker value of ordered lists violates a given style",
"license": "MIT",
"keywords": [
"lint",
"list",
"marker",
"ordered",
"remark",
"lint",
"rule",
"remark-lint",
"remark-lint-rule",
"ordered",
"list",
"marker"
"rule"
],
"repository": {
"type": "git",
"url": "https://github.com/remarkjs/remark-lint",
"directory": "packages/remark-lint-ordered-list-marker-value"
},
"repository": "https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-ordered-list-marker-value",
"bugs": "https://github.com/remarkjs/remark-lint/issues",

@@ -27,28 +24,39 @@ "funding": {

"contributors": [
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
"Titus <tituswormer@gmail.com>",
"Titus Wormer <tituswormer@gmail.com>"
],
"sideEffects": false,
"type": "module",
"main": "index.js",
"types": "index.d.ts",
"exports": "./index.js",
"files": [
"index.d.ts",
"index.d.ts.map",
"index.js"
],
"dependencies": {
"@types/mdast": "^3.0.0",
"unified": "^10.0.0",
"unified-lint-rule": "^2.0.0",
"unist-util-generated": "^2.0.0",
"unist-util-position": "^4.0.0",
"unist-util-visit": "^4.0.0"
"@types/mdast": "^4.0.0",
"devlop": "^1.0.0",
"mdast-util-phrasing": "^4.0.0",
"micromark-util-character": "^2.0.0",
"unified-lint-rule": "^3.0.0",
"unist-util-position": "^5.0.0",
"unist-util-visit-parents": "^6.0.0",
"vfile-message": "^4.0.0"
},
"scripts": {},
"xo": false,
"typeCoverage": {
"atLeast": 100,
"detail": true,
"strict": true,
"ignoreCatch": true
"ignoreCatch": true,
"strict": true
},
"xo": {
"prettier": true,
"rules": {
"capitalized-comments": "off",
"complexity": "off",
"unicorn/prefer-code-point": "off",
"unicorn/prefer-string-replace-all": "off"
}
}
}

@@ -5,44 +5,45 @@ <!--This file is generated-->

[![Build][build-badge]][build]
[![Coverage][coverage-badge]][coverage]
[![Downloads][downloads-badge]][downloads]
[![Size][size-badge]][size]
[![Sponsors][sponsors-badge]][collective]
[![Backers][backers-badge]][collective]
[![Chat][chat-badge]][chat]
[![Build][badge-build-image]][badge-build-url]
[![Coverage][badge-coverage-image]][badge-coverage-url]
[![Downloads][badge-downloads-image]][badge-downloads-url]
[![Size][badge-size-image]][badge-size-url]
[![Sponsors][badge-funding-sponsors-image]][badge-funding-url]
[![Backers][badge-funding-backers-image]][badge-funding-url]
[![Chat][badge-chat-image]][badge-chat-url]
[`remark-lint`][mono] rule to warn when ordered list values are inconsistent.
[`remark-lint`][github-remark-lint] rule to warn when ordered list values are inconsistent.
## Contents
* [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(remarkLintOrderedListMarkerValue[, config])`](#unifieduseremarklintorderedlistmarkervalue-config)
* [Recommendation](#recommendation)
* [Fix](#fix)
* [Examples](#examples)
* [Compatibility](#compatibility)
* [Contribute](#contribute)
* [License](#license)
* [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(remarkLintOrderedListMarkerValue[, options])`](#unifieduseremarklintorderedlistmarkervalue-options)
* [`Options`](#options)
* [`Style`](#style)
* [Recommendation](#recommendation)
* [Fix](#fix)
* [Examples](#examples)
* [Compatibility](#compatibility)
* [Contribute](#contribute)
* [License](#license)
## What is this?
This package is a [unified][] ([remark][]) plugin, specifically a `remark-lint`
rule.
Lint rules check markdown code style.
This package checks ordered list values.
## When should I use this?
You can use this package to check that ordered list values are consistent.
You can use this package to check ordered lists.
## Presets
This rule is included in the following presets:
This plugin is included in the following presets:
| Preset | Setting |
| Preset | Options |
| - | - |
| [`remark-preset-lint-consistent`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-consistent) | `'consistent'` |
| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-markdown-style-guide) | `'one'` |

@@ -52,4 +53,5 @@

This package is [ESM only][esm].
In Node.js (version 12.20+, 14.14+, or 16.0+), install with [npm][]:
This package is [ESM only][github-gist-esm].
In Node.js (version 16+),
install with [npm][npm-install]:

@@ -60,13 +62,13 @@ ```sh

In Deno with [`esm.sh`][esmsh]:
In Deno with [`esm.sh`][esm-sh]:
```js
import remarkLintOrderedListMarkerValue from 'https://esm.sh/remark-lint-ordered-list-marker-value@3'
import remarkLintOrderedListMarkerValue from 'https://esm.sh/remark-lint-ordered-list-marker-value@4'
```
In browsers with [`esm.sh`][esmsh]:
In browsers with [`esm.sh`][esm-sh]:
```html
<script type="module">
import remarkLintOrderedListMarkerValue from 'https://esm.sh/remark-lint-ordered-list-marker-value@3?bundle'
import remarkLintOrderedListMarkerValue from 'https://esm.sh/remark-lint-ordered-list-marker-value@4?bundle'
</script>

@@ -80,18 +82,20 @@ ```

```js
import remarkLint from 'remark-lint'
import remarkLintOrderedListMarkerValue from 'remark-lint-ordered-list-marker-value'
import remarkParse from 'remark-parse'
import remarkStringify from 'remark-stringify'
import {read} from 'to-vfile'
import {unified} from 'unified'
import {reporter} from 'vfile-reporter'
import {remark} from 'remark'
import remarkLint from 'remark-lint'
import remarkLintOrderedListMarkerValue from 'remark-lint-ordered-list-marker-value'
main()
const file = await read('example.md')
async function main() {
const file = await remark()
.use(remarkLint)
.use(remarkLintOrderedListMarkerValue)
.process(await read('example.md'))
await unified()
.use(remarkParse)
.use(remarkLint)
.use(remarkLintOrderedListMarkerValue)
.use(remarkStringify)
.process(file)
console.error(reporter(file))
}
console.error(reporter(file))
```

@@ -102,3 +106,3 @@

```sh
remark --use remark-lint --use remark-lint-ordered-list-marker-value example.md
remark --frail --use remark-lint --use remark-lint-ordered-list-marker-value .
```

@@ -124,36 +128,69 @@

This package exports no identifiers.
The default export is `remarkLintOrderedListMarkerValue`.
It exports the [TypeScript][typescript] types
[`Options`][api-options] and
[`Style`][api-style].
The default export is
[`remarkLintOrderedListMarkerValue`][api-remark-lint-ordered-list-marker-value].
### `unified().use(remarkLintOrderedListMarkerValue[, config])`
### `unified().use(remarkLintOrderedListMarkerValue[, options])`
This rule supports standard configuration that all remark lint rules accept
(such as `false` to turn it off or `[1, options]` to configure it).
Warn when ordered list values are inconsistent.
The following options (default: `'ordered'`) are accepted:
###### Parameters
* `'ordered'`
— values should increment by one from the first item
* `'single'`
— values should stay the same as the first item
* `'one'`
— values should always be exactly `1`
* `options` ([`Options`][api-options], default: `'consistent'`)
— preferred style
###### Returns
Transform ([`Transformer` from `unified`][github-unified-transformer]).
### `Options`
Configuration (TypeScript type).
`consistent` looks at the first list with two or more items, and
infer `'single'` if both are the same, and `'ordered'` otherwise.
###### Type
```ts
type Options = Style | 'consistent'
```
### `Style`
Counter style (TypeScript type).
* `'one'`
— values should always be exactly `1`
* `'ordered'`
— values should increment by one from the first item
* `'single'`
— values should stay the same as the first item
###### Type
```ts
type Style = 'one' | 'ordered' | 'single'
```
## Recommendation
While `'single'` might be the smartest style, as it makes it easier to move
items around without having to renumber everything and doesn’t have
problems with aligning content of the 9th and the 10th item, it’s not used a
lot and arguably looks unnatural.
While `'single'` might be the smartest style,
as it makes it easier to move items around without having to renumber
everything and doesn’t have problems with aligning content of the 9th and
the 10th item,
it’s not used a lot and arguably looks unnatural.
`'one'` is like `'single'` but forces every list to start at `1`.
While not often needed, starting lists at other values is sometimes useful.
Due to this, `'ordered'` is recommended, although `'single'` is also a viable
choice.
While not often needed,
starting lists at other values is sometimes useful.
So `'ordered'` is recommended,
although `'single'` is also a viable choice.
## Fix
[`remark-stringify`](https://github.com/remarkjs/remark/tree/main/packages/remark-stringify)
retains the value of the first item and increments further items by default.
Pass
[`incrementListMarker: false`](https://github.com/remarkjs/remark/tree/main/packages/remark-stringify#optionsincrementlistmarker)
to not increment further items.
[`remark-stringify`][github-remark-stringify] retains the value of the first
item and increments further items by default.
Pass `incrementListMarker: false` to not increment further items.

@@ -167,18 +204,13 @@ ## Examples

```markdown
The default value is `ordered`, so unless changed, the below
is OK.
1. Mercury
2. Venus
1. Foo
2. Bar
3. Baz
***
Paragraph.
3. Earth
4. Mars
3. Alpha
4. Bravo
5. Charlie
***
Unordered lists are not affected by this rule.
* Anton
* Jupiter
```

@@ -190,18 +222,14 @@

##### `ok.md`
##### `ok-infer-single.md`
When configured with `'one'`.
###### In
```markdown
1. Foo
1. Bar
1. Baz
2. Mercury
2. Venus
Paragraph.
***
1. Alpha
1. Bravo
1. Charlie
3. Earth
3. Mars
```

@@ -213,11 +241,14 @@

##### `not-ok.md`
##### `nok-chaotic.md`
When configured with `'one'`.
###### In
```markdown
1. Foo
2. Bar
2. Mercury
1. Venus
***
1. Earth
1. Mars
```

@@ -228,6 +259,7 @@

```text
2:1-2:8: Marker should be `1`, was `2`
2:2: Unexpected ordered list item value `1`, expected `3`
7:2: Unexpected ordered list item value `1`, expected `2`
```
##### `also-not-ok.md`
##### `ok.md`

@@ -239,4 +271,4 @@ When configured with `'one'`.

```markdown
2. Foo
1. Bar
1. Mercury
1. Venus
```

@@ -246,9 +278,7 @@

```text
1:1-1:8: Marker should be `1`, was `2`
```
No messages.
##### `ok.md`
When configured with `'single'`.
When configured with `'ordered'`.

@@ -258,17 +288,14 @@ ###### In

```markdown
1. Foo
1. Bar
1. Baz
1. Mercury
2. Venus
Paragraph.
***
3. Alpha
3. Bravo
3. Charlie
3. Earth
4. Mars
Paragraph.
***
0. Delta
0. Echo
0. Foxtrot
0. Jupiter
1. Saturn
```

@@ -282,3 +309,3 @@

When configured with `'ordered'`.
When configured with `'single'`.

@@ -288,17 +315,14 @@ ###### In

```markdown
1. Foo
2. Bar
3. Baz
1. Mercury
1. Venus
Paragraph.
***
3. Alpha
4. Bravo
5. Charlie
3. Earth
3. Mars
Paragraph.
***
0. Delta
1. Echo
2. Foxtrot
0. Jupiter
0. Saturn
```

@@ -312,2 +336,30 @@

When configured with `'one'`.
###### In
```markdown
1. Mercury
2. Venus
***
3. Earth
***
2. Mars
1. Jupiter
```
###### Out
```text
2:2: Unexpected ordered list item value `2`, expected `1`
6:2: Unexpected ordered list item value `3`, expected `1`
10:2: Unexpected ordered list item value `2`, expected `1`
```
##### `not-ok.md`
When configured with `'ordered'`.

@@ -318,4 +370,9 @@

```markdown
1. Foo
1. Bar
1. Mercury
1. Venus
***
2. Mars
1. Jupiter
```

@@ -326,3 +383,4 @@

```text
2:1-2:8: Marker should be `2`, was `1`
2:2: Unexpected ordered list item value `1`, expected `2`
7:2: Unexpected ordered list item value `1`, expected `3`
```

@@ -332,24 +390,51 @@

When configured with `'💩'`.
When configured with `'single'`.
###### In
```markdown
1. Mercury
2. Venus
***
2. Mars
1. Jupiter
```
###### Out
```text
1:1: Incorrect ordered list item marker value `💩`: use either `'ordered'`, `'one'`, or `'single'`
2:2: Unexpected ordered list item value `2`, expected `1`
7:2: Unexpected ordered list item value `1`, expected `2`
```
##### `not-ok.md`
When configured with `'🌍'`.
###### Out
```text
1:1: Unexpected value `🌍` for `options`, expected `'one'`, `'ordered'`, `'single'`, or `'consistent'`
```
## Compatibility
Projects maintained by the unified collective are compatible with all maintained
Projects maintained by the unified collective are compatible with 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.
When we cut a new major release, we drop support for unmaintained versions of
Node.
This means we try to keep the current release line,
`remark-lint-ordered-list-marker-value@4`,
compatible with Node.js 16.
## Contribute
See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways
See [`contributing.md`][github-dotfiles-contributing] in [`remarkjs/.github`][github-dotfiles-health] for ways
to get started.
See [`support.md`][support] for ways to get help.
See [`support.md`][github-dotfiles-support] for ways to get help.
This project has a [code of conduct][coc].
This project has a [code of conduct][github-dotfiles-coc].
By interacting with this repository, organization, or community you agree to

@@ -360,52 +445,60 @@ abide by its terms.

[MIT][license] © [Titus Wormer][author]
[MIT][file-license] © [Titus Wormer][author]
[build-badge]: https://github.com/remarkjs/remark-lint/workflows/main/badge.svg
[api-options]: #options
[build]: https://github.com/remarkjs/remark-lint/actions
[api-remark-lint-ordered-list-marker-value]: #unifieduseremarklintorderedlistmarkervalue-options
[coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg
[api-style]: #style
[coverage]: https://codecov.io/github/remarkjs/remark-lint
[author]: https://wooorm.com
[downloads-badge]: https://img.shields.io/npm/dm/remark-lint-ordered-list-marker-value.svg
[badge-build-image]: https://github.com/remarkjs/remark-lint/workflows/main/badge.svg
[downloads]: https://www.npmjs.com/package/remark-lint-ordered-list-marker-value
[badge-build-url]: https://github.com/remarkjs/remark-lint/actions
[size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-ordered-list-marker-value.svg
[badge-chat-image]: https://img.shields.io/badge/chat-discussions-success.svg
[size]: https://bundlephobia.com/result?p=remark-lint-ordered-list-marker-value
[badge-chat-url]: https://github.com/remarkjs/remark/discussions
[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg
[badge-coverage-image]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg
[backers-badge]: https://opencollective.com/unified/backers/badge.svg
[badge-coverage-url]: https://codecov.io/github/remarkjs/remark-lint
[collective]: https://opencollective.com/unified
[badge-downloads-image]: https://img.shields.io/npm/dm/remark-lint-ordered-list-marker-value.svg
[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg
[badge-downloads-url]: https://www.npmjs.com/package/remark-lint-ordered-list-marker-value
[chat]: https://github.com/remarkjs/remark/discussions
[badge-funding-backers-image]: https://opencollective.com/unified/backers/badge.svg
[unified]: https://github.com/unifiedjs/unified
[badge-funding-sponsors-image]: https://opencollective.com/unified/sponsors/badge.svg
[remark]: https://github.com/remarkjs/remark
[badge-funding-url]: https://opencollective.com/unified
[mono]: https://github.com/remarkjs/remark-lint
[badge-size-image]: https://img.shields.io/bundlejs/size/remark-lint-ordered-list-marker-value
[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
[badge-size-url]: https://bundlejs.com/?q=remark-lint-ordered-list-marker-value
[esmsh]: https://esm.sh
[esm-sh]: https://esm.sh
[npm]: https://docs.npmjs.com/cli/install
[file-license]: https://github.com/remarkjs/remark-lint/blob/main/license
[health]: https://github.com/remarkjs/.github
[github-dotfiles-coc]: https://github.com/remarkjs/.github/blob/main/code-of-conduct.md
[contributing]: https://github.com/remarkjs/.github/blob/main/contributing.md
[github-dotfiles-contributing]: https://github.com/remarkjs/.github/blob/main/contributing.md
[support]: https://github.com/remarkjs/.github/blob/main/support.md
[github-dotfiles-health]: https://github.com/remarkjs/.github
[coc]: https://github.com/remarkjs/.github/blob/main/code-of-conduct.md
[github-dotfiles-support]: https://github.com/remarkjs/.github/blob/main/support.md
[license]: https://github.com/remarkjs/remark-lint/blob/main/license
[github-gist-esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
[author]: https://wooorm.com
[github-remark-lint]: https://github.com/remarkjs/remark-lint
[github-remark-stringify]: https://github.com/remarkjs/remark/tree/main/packages/remark-stringify
[github-unified-transformer]: https://github.com/unifiedjs/unified#transformer
[npm-install]: https://docs.npmjs.com/cli/install
[typescript]: https://www.typescriptlang.org
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc