myst-to-docx
Version:
Export from a MyST Markdown document to Microsoft Word (*.docx)
27 lines • 1.53 kB
TypeScript
import type { Footer, INumberingOptions, ISectionOptions } from 'docx';
import { InternalHyperlink, Bookmark, Document } from 'docx';
import { Buffer } from 'buffer';
import type { PageFrontmatter } from 'myst-frontmatter';
import type { IFootnotes, Options } from './types.js';
import type { GenericParent } from 'myst-common';
export declare function createShortId(): string;
export declare function createDocFromState(state: {
numbering: INumberingOptions['config'];
children: ISectionOptions['children'];
frontmatter: PageFrontmatter;
footnotes?: IFootnotes;
}, footer?: Footer, styles?: string): Document;
export declare function writeDocx(doc: Document, write: ((buffer: Buffer) => void) | ((buffer: Buffer) => Promise<void>)): Promise<void>;
export declare const MAX_DOCX_IMAGE_WIDTH = 600;
export declare function getImageWidth(width?: number | string, maxWidth?: number): number;
/**
* For frontend development, fetch images as Blobs, get their dimensions and
* return options for the docx serializer.
*
* @param tree the mdast document
* @returns options for the serializer
*/
export declare function fetchImagesAsBuffers(tree: GenericParent): Promise<Required<Pick<Options, 'getImageBuffer' | 'getImageDimensions'>>>;
export declare function createReferenceBookmark(id: string, kind: 'Equation' | 'Figure' | 'Table', before?: string, after?: string): Bookmark;
export declare function createReference(id: string, before?: string, after?: string): InternalHyperlink;
//# sourceMappingURL=utils.d.ts.map