remark-flexible-containers
Version:
Remark plugin to add custom containers with customizable properties in markdown
53 lines • 1.78 kB
TypeScript
import type { Plugin } from "unified";
import type { BlockContent, Data, Parent, Root } from "mdast";
interface ContainerData extends Data {
}
interface Container extends Parent {
type: "container";
children: BlockContent[];
data?: ContainerData | undefined;
}
declare module "mdast" {
interface BlockContentMap {
container: Container;
}
interface RootContentMap {
container: Container;
}
}
interface Properties {
[PropertyName: string]: boolean | number | string | null | undefined | Array<string | number>;
}
type TitleFunction = (type?: string, title?: string) => string | null | undefined;
type TagNameFunction = (type?: string, title?: string) => string;
type ClassNameFunction = (type?: string, title?: string) => string[];
type PropertyFunction = (type?: string, title?: string) => Omit<Properties, "className"> & {
className?: never;
};
export type FlexibleContainerOptions = {
title?: TitleFunction;
containerTagName?: string | TagNameFunction;
containerClassName?: string | ClassNameFunction;
containerProperties?: PropertyFunction;
titleTagName?: string | TagNameFunction;
titleClassName?: string | ClassNameFunction;
titleProperties?: PropertyFunction;
};
export declare const REGEX_START: RegExp;
export declare const REGEX_END: RegExp;
export declare const REGEX_BAD_SYNTAX: RegExp;
export declare const REGEX_CUSTOM: RegExp;
/**
*
* This plugin adds container node with customizable properties in order to produce container element like callouts and admonitions
*
* for example:
*
* ::: warning My Title
* Content with **bold text**
* :::
*
*/
export declare const plugin: Plugin<[FlexibleContainerOptions?], Root>;
export default plugin;
//# sourceMappingURL=index.d.ts.map