@md2docx/table
Version:
Plugin to convert Markdown tables (MDAST) to DOCX with support for rich formatting and seamless integration into mdast2docx.
35 lines (34 loc) • 1.35 kB
TypeScript
import { AlignmentType, type ITableCellOptions, type ITableOptions, type ITableRowOptions, VerticalAlignTable } from "docx";
import { IPlugin, Optional } from "@m2d/core";
export type RowProps = Omit<ITableRowOptions, "children">;
export type TableProps = Omit<ITableOptions, "rows">;
export type CellProps = Omit<ITableCellOptions, "children">;
export interface ITableAlignments {
defaultVerticalAlign?: (typeof VerticalAlignTable)[keyof typeof VerticalAlignTable];
defaultHorizontalAlign?: (typeof AlignmentType)[keyof typeof AlignmentType];
/**
* Use MDAST data for horizontal aligning columns
* @default true
*/
preferMdData?: boolean;
}
interface IDefaultTablePluginProps {
tableProps: TableProps;
rowProps: RowProps;
cellProps: CellProps;
firstRowProps: RowProps;
firstRowCellProps: CellProps & {
alignment?: (typeof AlignmentType)[keyof typeof AlignmentType];
};
alignments: ITableAlignments;
}
type ITablePluginProps = Optional<IDefaultTablePluginProps>;
/**
* default table options
*/
export declare const defaultTableOptions: IDefaultTablePluginProps;
/**
* Plugin to convert Markdown tables (MDAST) to DOCX with support for rich formatting and seamless integration into mdast2docx.
*/
export declare const tablePlugin: (options?: ITablePluginProps) => IPlugin;
export {};