// 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 = `

Quarterly report

Sales were up 12%1, led by EMEA2.

Footnotes

  1. Compared with the same quarter last year. ↩

  2. Europe, the Middle East and Africa, with:

    • Germany
    • Kenya

    ↩

`; const word = `

The method is described elsewhere[i].



[i] Smith, A Book, 2001, page 12.

`; const doc = new Document({ sections: [{ children: [...htmlToContent(markdown), ...htmlToContent(word)] }], }); Packer.toBuffer(doc).then((buffer) => { fs.writeFileSync("My Document.docx", buffer); });