@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) • 1.61 kB
JavaScript
;var a=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var P=(t,e)=>{for(var n in e)a(t,n,{get:e[n],enumerable:!0})},u=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of c(e))!d.call(t,r)&&r!==n&&a(t,r,{get:()=>e[r],enumerable:!(o=l(e,r))||o.enumerable});return t};var f=t=>u(a({},"__esModule",{value:!0}),t);var g={};P(g,{convertInchesToTwip:()=>i.convertInchesToTwip,convertMillimetersToTwip:()=>i.convertMillimetersToTwip,defaultDocxProps:()=>h,defaultSectionProps:()=>x,getDefinitions:()=>s,getTextContent:()=>p});module.exports=f(g);var i=require("docx"),s=t=>{let e={},n={};return t.forEach(o=>{var r;o.type==="definition"?e[o.identifier.toUpperCase()]=o.url:o.type==="footnoteDefinition"?n[o.identifier.toUpperCase()]={children:o.children}:(r=o.children)!=null&&r.length&&Object.assign(e,s(o.children))}),{definitions:e,footnoteDefinitions:n}},p=t=>{var e,n;return(e=t.children)!=null&&e.length?t.children.map(p).join(""):(n=t.value)!=null?n:""},x={useTitle:!0,plugins:[]},h={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}}}}}};0&&(module.exports={convertInchesToTwip,convertMillimetersToTwip,defaultDocxProps,defaultSectionProps,getDefinitions,getTextContent});