mdast-to-docx
Version:
Convert Markdown Abstract Syntax Tree (MDAST) to DOCX seamlessly. Supports footnotes, images, links, and customizable document properties.
33 lines (32 loc) • 1.22 kB
TypeScript
/**
* This plugin is not working at the moment because of issues in installing sharp or canvas
*/
/** biome-ignore-all lint/suspicious/noExplicitAny: typecasting necessary */
import type { IPlugin } from "@m2d/core";
import type { IImageOptions } from "docx";
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 {};