docx-ast
v0.0.10
Published
Extract an ast tree from a docx file
Downloads
187
Readme
DOCX Document reader
This library reads docx files and turns them into useful ASTs which tries to simplify the conversion from docx to markdown/html/...
There is also an existing function for converting the AST to HTML.
Example:
import fs from "node:fs";
import {
extractNodeList,
postProcessDocument,
postProcessedDocToHtml,
} from "docx-ast";
const content = fs.readFileSync("test.docx");
const rawAst = await extractNodeList(content);
const processedAst = postProcessDocument(rawAst.value);
const html = postProcessedDocToHtml(processedAst);
console.log(html);