mdast-to-docx
Version:
Convert Markdown Abstract Syntax Tree (MDAST) to DOCX seamlessly. Supports footnotes, images, links, and customizable document properties.
32 lines (31 loc) • 1.13 kB
TypeScript
/**
* This plugin is not working at the moment because of issues in installing sharp or canvas
*/
import { IImageOptions } from "docx";
import { IPlugin } from "@m2d/core";
export declare const SUPPORTED_IMAGE_TYPES: readonly ["jpg", "gif", "png"];
/**
* Resolves an image source URL into the appropriate image options for DOCX conversion.
*/
export type NodeImageResolver = (src: string, options?: INodeImagePluginOptions) => Promise<IImageOptions>;
interface INodeImagePluginOptions {
/**
* pathPrefix
*/
pathPrefix?: string;
/**
* Fallback image type if the image type cannot be determined or is not supported.
* @default "png"
*/
fallbackImageType?: "png" | "jpg" | "gif";
/**
* Custom image resolver to resolve an image source URL into the appropriate image options for DOCX conversion.
*/
imageResolver?: NodeImageResolver;
}
/**
* Image plugin for processing inline image nodes in Markdown AST.
* This plugin is designed for server-side (node.js) environments.
*/
export declare const nodeImagePlugin: (options?: INodeImagePluginOptions) => IPlugin;
export {};