remark-heading-gap
Version:
remark plugin to adjust the gap between headings
40 lines (39 loc) • 1.15 kB
TypeScript
/**
* Adjust the gap between headings.
*
* There are no blank lines added if a heading is the first or last child of
* the document, list item, or block quote.
* For example, pass `{1: {before: 2, after: 2}}` to add two blank lines before
* and after the main heading.
* You can also set values to `0` to not add blank lines.
*
* @param {Readonly<Options> | null | undefined} [options]
* Configuration (optional).
* @returns {undefined}
* Nothing.
*/
export default function remarkHeadingGap(options?: Readonly<Options> | null | undefined): undefined;
export type Heading = import('mdast').Heading;
export type Root = import('mdast').Root;
export type Processor = import('unified').Processor<undefined, undefined, undefined, Root>;
/**
* Gap between a heading.
*/
export type Gap = {
/**
* Blank lines after a heading.
*/
after?: number | null | undefined;
/**
* Blank lines before a heading.
*/
before?: number | null | undefined;
};
/**
* Configuration;
*/
export type Options = Partial<Record<Rank, Gap | null | undefined>>;
/**
* Heading rank.
*/
export type Rank = Heading['depth'];