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