@coconutstudio/blocknote-word-exporter-mit
v1.0.1
Published
MIT Word (.docx) exporter for BlockNote JSON. Independent rewrite — not a fork or copy of @blocknote/xl-docx-exporter. Used in production by coconutStudio.
Maintainers
Readme
@coconutstudio/blocknote-word-exporter-mit
MIT Word (.docx) exporter for BlockNote document JSON.
Walk a block tree (type / props / content / children) and return a .docx Blob using the MIT docx library.
Used in production by coconutStudio for shareable document Word export.
Not the official BlockNote exporter
This package is independent. It is not a fork, port, wrapper, or copy of @blocknote/xl-docx-exporter (licensed GPL-3.0 OR PROPRIETARY).
| | This package | @blocknote/xl-docx-exporter |
| --- | --- | --- |
| License | MIT | GPL-3.0 or paid proprietary |
| Input | Public BlockNote document JSON | BlockNote editor schema + mappings |
| Runtime | No @blocknote/* | BlockNote exporter classes |
| Fonts / proxies | None | BlockNote-hosted fonts and file proxy |
We implemented Word output from the public JSON document format + docx APIs (native Heading 1–6, our own list numbering). We did not copy BlockNote exporter source.
Not affiliated with TypeCell / BlockNote.
Install
npm install @coconutstudio/blocknote-word-exporter-mitAPI
import { blocksToDocx, prependDocumentTitle } from '@coconutstudio/blocknote-word-exporter-mit';
const blob = await blocksToDocx(editor.document, {
documentTitle: 'Pricing',
images: {
[blockId]: { data: uint8, widthPx: 720, heightPx: 400, alt: 'Chart' },
},
fetchFile: async (url) => {
const res = await fetch(url);
if (!res.ok) throw new Error(String(res.status));
return res.arrayBuffer();
},
});- Headings become Word Heading 1–6 in black (H1 largest).
- Tables span the page content width.
- Lists use package numbering (
cbn-bullet,cbn-number). coconutVisualblocks render as images whenimages[block.id]is set; otherwise a[Chart: title]caption.- Unknown block types become a short fallback paragraph instead of throwing.
Chart rasterization (HTML/SVG → PNG) stays in the host app; pass the bytes in images.
License
MIT © coconutStudio
