UNPKG

remark-directive-sugar

Version:

Remark plugin built on remark-directive, providing predefined directives for image captions, video embedding, styled GitHub links, badges, and more.

22 lines (21 loc) 1.15 kB
import type { Properties } from 'hast'; import type { Directives } from 'mdast-util-directive'; /** * Creates a regex for matching the directive. */ export declare const createDirectiveRegex: (directiveName: string, alias: string | string[] | null | undefined) => RegExp; /** * Call a function to get a return value or use the value. */ export declare function createIfNeeded<T extends Directives>(value: ((node: T) => Properties | null | undefined) | Properties | null | undefined, node: T): Properties | null | undefined; /** * Merges the props of global, preset, and local into a single object: * - The order of precedence is: localProps > presetProps > globalProps. * - For class or className, do not override but merge into a new className. */ export declare function mergeProps(globalProps: Properties | null | undefined, presetProps: Properties | null | undefined, localProps: Record<string, string | null | undefined> | null | undefined): Properties; /** * Process a URL by removing the protocol and shortening the path * to a maximum length. */ export declare function processUrl(url: string, maxPathLength?: number): string;