remark-lint-list-item-style
Version:
remark-lint rule to warn when list items violate a given style
60 lines • 2.15 kB
TypeScript
import type { Plugin } from 'unified';
/**
* Valid values for the Options.checkFirstWord property.
*/
export declare const optionsCheckFirstWord: readonly [false, "capitalize", "lowercase"];
/**
* Valid values for the Options.checkListSpread property.
*/
export declare const optionsCheckListSpread: readonly ["first", "final", "first-and-final", "each"];
/**
* Options type for the remark-lint-list-item-style plugin.
*/
export type Options = {
/**
* Checks that the final character of each stringified list item matches at
* least one of the given values.
*
* To match all unicode punctuation characters, you could provide `["\p{P}"]`
* instead of the default, but this will match characters like `)` and `]`.
*
* Alternatively, to prevent punctuation, you could provide `["\P{P}"]`.
*
* Lines that consist solely of an image are ignored.
*
* @default ["(\\.|\\?|;|,|!)"]
*/
checkPunctuation?: false | (string | RegExp)[];
/**
* Checks that the first word of each stringified list item paragraph begins
* with a non-lowercase character (`"capitalize"`) or a non-uppercase
* character (`"lowercase"`).
*
* List items beginning with a link, image, or inline code block are ignored.
*
* @default "capitalize"
*/
checkFirstWord?: (typeof optionsCheckFirstWord)[number];
/**
* Words that would normally be checked with respect to the `checkFirstWord`
* option will be ignored if they match at least one of the given values.
*
* Use this option to prevent false positives (e.g. "iOS", "eBay").
*
* @default []
*/
ignoredFirstWords?: (string | RegExp)[];
/**
* Determines how `checkPunctuation` is applied to list items with spread
* children. Has no effect when `checkPunctuation` is `false`.
*
* @default "each"
*/
checkListSpread?: (typeof optionsCheckListSpread)[number];
};
/**
* A remark-lint rule that takes a Root node as input and attaches any error
* messages to the resulting virtual file pertaining to list item style.
*/
declare const remarkLintListItemStyle: Plugin<[Options] | []>;
export default remarkLintListItemStyle;