// The notes of HTML as Word's footnotes and endnotes (issue #2632): the footnotes that Markdown becomes, here GitHub's, // and the endnotes Word puts on the clipboard. The links back to the references and the list of notes are left out. // See docs/usage/html.md. // cspell:ignore EMEA ednref import * as fs from "fs"; import { Document, Packer } from "docx"; import { htmlToContent } from "docx/html"; const markdown = `
Sales were up 12%1, led by EMEA2.
The method is described elsewhere[i].
`; const doc = new Document({ sections: [{ children: [...htmlToContent(markdown), ...htmlToContent(word)] }], }); Packer.toBuffer(doc).then((buffer) => { fs.writeFileSync("My Document.docx", buffer); });