remark-directive-sugar
Version:
Remark plugin built on remark-directive, providing predefined directives for image captions, video embedding, styled GitHub links, badges, and more.
28 lines (27 loc) • 1.38 kB
TypeScript
/**
* @see https://github.com/remarkjs/remark-directive?tab=readme-ov-file#types
*/
import type { Root } from 'mdast';
import type { Plugin } from 'unified';
import type { Options } from './types.js';
/**
* A remark plugin built on top of {@link https://github.com/remarkjs/remark-directive remark-directive},
* supporting {@link https://github.com/remarkjs/remark-directive?tab=readme-ov-file#use regular usage}
* and providing the following predefined directives:
*
* - `:badge[-*]`: Generates customizable badges.
* - `:link`: Creates links to GitHub, npm, or custom URLs.
* - `::video[-*]`: Embeds videos from platforms like YouTube, Bilibili, Vimeo, or custom sources.
* - `:::image-*`: Wraps an image inside valid HTML tags, such as a `<figure>` element to
* allow adding a descriptive `<figcaption>`, or a hyperlink to make it clickable, and more.
*
* @param options
* Optional options to configure the output.
* @returns
* A unified transformer.
*
* @see https://github.com/lin-stephanie/remark-directive-sugar
*/
declare const remarkDirectiveSugar: Plugin<[Options?], Root>;
export default remarkDirectiveSugar;
export type { Options, BadgeDirectiveConfig, LinkDirectiveConfig, VideoDirectiveConfig, ImageDirectiveConfig, PropertiesFromContainerDirective, PropertiesFromLeafDirective, PropertiesFromTextDirective, } from './types.js';