diff --git a/mindspace-docx-export.mjs b/mindspace-docx-export.mjs
new file mode 100644
index 0000000..7be3c67
--- /dev/null
+++ b/mindspace-docx-export.mjs
@@ -0,0 +1,167 @@
+const W_NS = 'http://schemas.openxmlformats.org/wordprocessingml/2006/main';
+const R_NS = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships';
+
+const CONTENT_TYPES = `
+
+
+
+
+`;
+
+const ROOT_RELS = `
+
+
+`;
+
+const DOCUMENT_RELS = `
+`;
+
+function escapeXml(value) {
+ return String(value ?? '')
+ .replace(/&/g, '&')
+ .replace(//g, '>')
+ .replace(/"/g, '"');
+}
+
+function decodeHtmlEntities(value) {
+ return String(value ?? '')
+ .replace(/ /gi, ' ')
+ .replace(/&/gi, '&')
+ .replace(/</gi, '<')
+ .replace(/>/gi, '>')
+ .replace(/"/gi, '"')
+ .replace(/'/gi, "'")
+ .replace(/(\d+);/g, (_, code) => String.fromCodePoint(Number(code)))
+ .replace(/([0-9a-f]+);/gi, (_, code) => String.fromCodePoint(Number.parseInt(code, 16)));
+}
+
+export function extractPlainTextFromHtml(html) {
+ return decodeHtmlEntities(
+ String(html ?? '')
+ .replace(/