retext-quotes
Version:
retext plugin to check quotes and apostrophes
69 lines • 2.12 kB
TypeScript
/**
* Check quotes and apostrophes.
*
* ###### Notes
*
* This plugin knows about apostrophes as well and prefers `'` when
* `preferred: 'straight'`, and `’` otherwise.
*
* The values in `straight` and `smart` can be one or two characters.
* When two, the first character determines the opening quote and the second
* the closing quote at that level.
* When one, both the opening and closing quote are that character.
*
* The order in which the preferred quotes appear in their respective list
* determines which quotes to use at which level of nesting.
* So, to prefer `‘’` at the first level of nesting, and `“”` at the second,
* pass: `smart: ['‘’', '“”']`.
*
* If quotes are nested deeper than the given amount of quotes, the markers
* wrap around: a third level of nesting when using `smart: ['«»', '‹›']`
* should have double guillemets, a fourth single, a fifth double again, etc.
*
* @param {Readonly<Options> | null | undefined} [options]
* Configuration (optional).
* @returns
* Transform.
*/
export default function retextQuotes(options?: Readonly<Options> | null | undefined): (tree: Root, file: VFile) => undefined;
/**
* Marker.
*/
export type Marker = {
/**
* Whether the marker is `straight` or `smart`.
*/
style: Style;
/**
* The actual marker.
*/
marker: string;
/**
* What the marker seems to be for.
*/
type: "apostrophe" | "close" | "open" | undefined;
};
/**
* Configuration.
*/
export type Options = {
/**
* Style of quotes to use (default: `'smart'`).
*/
preferred?: Style | null | undefined;
/**
* List of quotes to see as “smart” (default: `['“”', '‘’']`).
*/
smart?: ReadonlyArray<string> | null | undefined;
/**
* List of quotes to see as “straight” (default: `['"', "'"]`).
*/
straight?: ReadonlyArray<string> | null | undefined;
};
/**
* Style.
*/
export type Style = "smart" | "straight";
import type { Root } from 'nlcst';
import type { VFile } from 'vfile';
//# sourceMappingURL=index.d.ts.map