UNPKG

@mdast2docx/core

Version:

Core engine to convert extended MDAST to DOCX. Supports plugins for footnotes, images, lists, tables, and more. Designed for seamless Markdown-to-DOCX conversion.

2 lines (1 loc) 924 B
import{convertInchesToTwip as c,convertMillimetersToTwip as f}from"docx";var i=t=>{let o={},n={};return t.forEach(e=>{var r;e.type==="definition"?o[e.identifier.toUpperCase()]=e.url:e.type==="footnoteDefinition"?n[e.identifier.toUpperCase()]={children:e.children}:(r=e.children)!=null&&r.length&&Object.assign(o,i(e.children))}),{definitions:o,footnoteDefinitions:n}},a=t=>{var o,n;return(o=t.children)!=null&&o.length?t.children.map(a).join(""):(n=t.value)!=null?n:""},s={useTitle:!0,plugins:[]},p={styles:{default:{document:{paragraph:{spacing:{before:175,line:300},alignment:"thaiDistribute"},run:{size:24}},heading1:{paragraph:{spacing:{before:350}}},heading2:{paragraph:{spacing:{before:350}}},heading3:{paragraph:{spacing:{before:350}}},heading4:{paragraph:{spacing:{before:350}}},heading5:{paragraph:{spacing:{before:350}}},heading6:{paragraph:{spacing:{before:350}}}}}};export{i as a,a as b,s as c,p as d,c as e,f};