mdast2docx 0.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +170 -0
- package/dist/chunk-KRMGJ4HN.mjs +2 -0
- package/dist/chunk-O6BHSWEF.mjs +37 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.js +38 -0
- package/dist/index.mjs +1 -0
- package/dist/section.d.ts +30 -0
- package/dist/section.js +38 -0
- package/dist/section.mjs +1 -0
- package/dist/utils.d.ts +55 -0
- package/dist/utils.js +37 -0
- package/dist/utils.mjs +1 -0
- package/package.json +106 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { OutputType, type IPropertiesOptions } from "@mayank1513/docx";
|
|
2
|
+
import type { Root } from "mdast";
|
|
3
|
+
import { type ISectionProps } from "./section";
|
|
4
|
+
/**
|
|
5
|
+
* Defines document properties, excluding sections and footnotes (which are managed internally).
|
|
6
|
+
*/
|
|
7
|
+
type IDocxProps = Omit<IPropertiesOptions, "sections" | "footnotes">;
|
|
8
|
+
/**
|
|
9
|
+
* Represents the input MDAST tree(s) for conversion.
|
|
10
|
+
* It can be a single root node or an array of objects containing the AST and optional section properties.
|
|
11
|
+
*/
|
|
12
|
+
type IInputMDAST = Root | {
|
|
13
|
+
ast: Root;
|
|
14
|
+
props?: ISectionProps;
|
|
15
|
+
}[];
|
|
16
|
+
/**
|
|
17
|
+
* Converts an MDAST (Markdown Abstract Syntax Tree) into a DOCX document.
|
|
18
|
+
* @param astInputs - A single or multiple MDAST trees with optional section properties.
|
|
19
|
+
* @param docxProps - General document properties. @see https://docx.js.org/#/usage/document
|
|
20
|
+
* @param defaultSectionProps - Default properties for each document section. @see https://docx.js.org/#/usage/sections
|
|
21
|
+
* @param outputType - The desired output format (default: `"blob"`). @see https://docx.js.org/#/usage/packers
|
|
22
|
+
* @returns A DOCX document in the specified format.
|
|
23
|
+
*/
|
|
24
|
+
export declare const toDocx: (astInputs: IInputMDAST, docxProps: IDocxProps, defaultSectionProps: ISectionProps, outputType?: OutputType) => Promise<string | ArrayBuffer | Buffer<ArrayBufferLike> | Uint8Array<ArrayBufferLike> | Blob | readonly number[]>;
|
|
25
|
+
export type { ISectionProps, IDocxProps, IInputMDAST };
|