UNPKG

@m2d/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) 929 B
import{convertInchesToTwip as d,convertMillimetersToTwip as P}from"docx";var i=o=>{let t={},n={};return o.forEach(e=>{var r;e.type==="definition"?t[e.identifier.toUpperCase()]=e.url:e.type==="footnoteDefinition"?n[e.identifier.toUpperCase()]={children:e.children}:(r=e.children)!=null&&r.length&&Object.assign(t,i(e.children))}),{definitions:t,footnoteDefinitions:n}},a=o=>{var t,n;return(t=o.children)!=null&&t.length?o.children.map(a).join(""):(n=o.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,d as e,P as f};