Comparing version
@@ -1,3 +0,3 @@ | ||
"use strict";var B=Object.create;var D=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var L=Object.getPrototypeOf,H=Object.prototype.hasOwnProperty;var U=(e,a)=>{for(var i in a)D(e,i,{get:a[i],enumerable:!0})},M=(e,a,i,s)=>{if(a&&typeof a=="object"||typeof a=="function")for(let p of A(a))!H.call(e,p)&&p!==i&&D(e,p,{get:()=>a[p],enumerable:!(s=F(a,p))||s.enumerable});return e};var z=(e,a,i)=>(i=e!=null?B(L(e)):{},M(a||!e||!e.__esModule?D(i,"default",{value:e,enumerable:!0}):i,e)),X=e=>M(D({},"__esModule",{value:!0}),e);var G={};U(G,{toDocx:()=>j});module.exports=X(G);var C=require("docx");var k=e=>{let a={},i={};return e.forEach(s=>{var p;s.type==="definition"?a[s.identifier.toUpperCase()]=s.url:s.type==="footnoteDefinition"?i[s.identifier.toUpperCase()]={children:s.children}:(p=s.children)!=null&&p.length&&Object.assign(a,k(s.children))}),{definitions:a,footnoteDefinitions:i}},O=e=>{var a,i;return(a=e.children)!=null&&a.length?e.children.map(O).join(""):(i=e.value)!=null?i:""},g={useTitle:!0,plugins:[]},N={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}}}}}};var v=z(require("docx")),_=(e,a,i)=>{let s=(p,I={})=>{var P,x;return((x=(P=p.children)==null?void 0:P.map(n=>{var u,r,o;let d=i.map(l=>{var f,m;return(m=(f=l.inline)==null?void 0:f.call(l,v,n,I,e,a,s))!=null?m:[]}).flat(),c=Object.assign({},I,n.data),h=(r=n.url)!=null?r:e[(u=n.identifier)==null?void 0:u.toUpperCase()];switch(n.type){case"text":return[...d,...c.pre?n.value.split(` | ||
`).map(l=>new C.TextRun({text:l,...c,break:1})):[new C.TextRun({text:n.value,...c})]];case"checkbox":return[...d,new C.CheckBox({checked:!!n.checked})];case"break":return[...d,new C.TextRun({break:1})];case"inlineCode":return[...d,new C.TextRun({text:n.value,...c,style:"code",font:{name:"Consolas"}})];case"emphasis":return c.italics=!0,[...d,...s(n,c)];case"strong":return c.bold=!0,[...d,...s(n,c)];case"delete":return c.strike=!0,[...d,...s(n,c)];case"link":case"linkReference":return c.underline={},[...d,h.startsWith("#")?new C.InternalHyperlink({anchor:h.slice(1),children:s(n,c)}):new C.ExternalHyperlink({link:h,children:s(n,c)})];case"footnoteReference":return[...d,new C.FootnoteReferenceRun((o=a[n.identifier].id)!=null?o:0)];case"fragment":return[...d,...s(n,c)];case"":return[...d];default:return console.warn(`Unsupported inline node type: ${n.type}`),[...d]}}))!=null?x:[]).flat()};return s},R=async(e,a,i,s)=>{var d;let{plugins:p,useTitle:I,...P}={...g,...s};for(let c of p)await((d=c.preprocess)==null?void 0:d.call(c,e));let x=_(a,i,p),n=(c,h)=>{var u;return(u=c.children)==null?void 0:u.map(r=>{var f,m,T,w;let o={...h},l=p.map(y=>{var b,S;return(S=(b=y.block)==null?void 0:b.call(y,v,r,o,n,x))!=null?S:[]}).flat();switch(Object.assign(o,r.data),r.type){case"paragraph":{let y=o.pre?{alignment:"left"}:{},b=typeof o.checked=="boolean"?[new C.CheckBox({checked:o.checked,checkedState:{value:"2611"},uncheckedState:{value:"2610"}}),new C.TextRun(" ")]:[];return[...l,new C.Paragraph({...y,...o,children:[...b,...x(r,o)]})]}case"heading":return[new C.Paragraph({...o,...l,heading:I?r.depth===1?"Title":`Heading${r.depth-1}`:`Heading${r.depth}`,children:[new C.Bookmark({id:O(r).replace(/[. ]+/g,"-").toLowerCase(),children:x(r,o)})]})];case"code":return[...l,new C.Paragraph({border:{bottom:{style:C.BorderStyle.SINGLE,space:5,size:1},left:{style:C.BorderStyle.SINGLE,space:10,size:1},right:{style:C.BorderStyle.SINGLE,space:5,size:1},top:{style:C.BorderStyle.SINGLE,space:6,size:1}},...o,alignment:"left",style:"blockCode",children:r.value.split(` | ||
`).map((y,b)=>new C.TextRun({...o,text:y,break:b===0?0:1,style:"code",font:{name:"Consolas"}}))})];case"list":return r.ordered?(o.bullet={level:((m=(f=o.bullet)==null?void 0:f.level)!=null?m:-1)+1},console.warn("Please add numbering plugin to support ordered lists. For now, we use only bullets for both the ordered and the unordered list.")):o.bullet={level:((w=(T=o.bullet)==null?void 0:T.level)!=null?w:-1)+1},[...l,...n(r,o)];case"blockquote":return[...l,...n(r,o)];case"listItem":return o.checked=r.checked,[...l,...n(r,o)];case"thematicBreak":return[...l,new C.Paragraph({...r.data,border:{top:{style:C.BorderStyle.SINGLE,size:6}}})];case"definition":case"footnoteDefinition":return l;case"table":return console.warn("Please add table plugin to support tables."),l;case"fragment":return[...l,...n(r,o)];case"":return l;case"yaml":case"html":default:return console.warn(`May be an unsupported node type: ${r.type}`,r),l}}).flat()};return{...P,children:n(e,{})}};var j=async(e,a={},i=g,s="blob")=>{var c;let p=1,I={},P={...N,...a};(c=i==null?void 0:i.plugins)==null||c.forEach(h=>{var u;return(u=h==null?void 0:h.root)==null?void 0:u.call(h,P)});let x=await Promise.all((Array.isArray(e)?e:[{ast:e}]).map(async({ast:h,props:u})=>{var l;let{definitions:r,footnoteDefinitions:o}=k(h.children);return await Promise.all(Object.values(o).map(async f=>{f.id=p,I[p]=await R({type:"root",children:f.children},r,{}),p++})),(l=u==null?void 0:u.plugins)==null||l.forEach(f=>{var m;return(m=f==null?void 0:f.root)==null?void 0:m.call(f,P)}),{ast:h,props:{...i,...u},definitions:r,footnoteDefinitions:o}})),n=await Promise.all(x.map(({ast:h,props:u,definitions:r,footnoteDefinitions:o})=>R(h,r,o,u))),d=new C.Document({...P,footnotes:I,sections:n});return C.Packer.pack(d,s)};0&&(module.exports={toDocx}); | ||
"use strict";var B=Object.create;var b=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var L=Object.getPrototypeOf,H=Object.prototype.hasOwnProperty;var U=(e,n)=>{for(var i in n)b(e,i,{get:n[i],enumerable:!0})},M=(e,n,i,s)=>{if(n&&typeof n=="object"||typeof n=="function")for(let p of A(n))!H.call(e,p)&&p!==i&&b(e,p,{get:()=>n[p],enumerable:!(s=F(n,p))||s.enumerable});return e};var z=(e,n,i)=>(i=e!=null?B(L(e)):{},M(n||!e||!e.__esModule?b(i,"default",{value:e,enumerable:!0}):i,e)),X=e=>M(b({},"__esModule",{value:!0}),e);var G={};U(G,{toDocx:()=>j});module.exports=X(G);var C=require("docx");var k=e=>{let n={},i={};return e.forEach(s=>{var p;s.type==="definition"?n[s.identifier.toUpperCase()]=s.url:s.type==="footnoteDefinition"?i[s.identifier.toUpperCase()]={children:s.children}:(p=s.children)!=null&&p.length&&Object.assign(n,k(s.children))}),{definitions:n,footnoteDefinitions:i}},O=e=>{var n,i;return(n=e.children)!=null&&n.length?e.children.map(O).join(""):(i=e.value)!=null?i:""},g={useTitle:!0,plugins:[]},N={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}}}}}};var v=z(require("docx")),_=(e,n,i)=>{let s=(p,I={})=>{var P,x;return((x=(P=p.children)==null?void 0:P.map(a=>{var u,r,o;let d=i.map(l=>{var f,m;return(m=(f=l.inline)==null?void 0:f.call(l,v,a,I,e,n,s))!=null?m:[]}).flat(),c=Object.assign({},I,a.data),h=(r=a.url)!=null?r:e[(u=a.identifier)==null?void 0:u.toUpperCase()];switch(a.type){case"text":return[...d,...c.pre?a.value.split(` | ||
`).map(l=>new C.TextRun({text:l,...c,break:1})):[new C.TextRun({text:a.value,...c})]];case"checkbox":return[...d,new C.CheckBox({checked:!!a.checked})];case"break":return[...d,new C.TextRun({break:1})];case"inlineCode":return[...d,new C.TextRun({text:a.value,...c,style:"code",font:{name:"Consolas"}})];case"emphasis":return c.italics=!0,[...d,...s(a,c)];case"strong":return c.bold=!0,[...d,...s(a,c)];case"delete":return c.strike=!0,[...d,...s(a,c)];case"link":case"linkReference":return c.underline={},[...d,h.startsWith("#")?new C.InternalHyperlink({anchor:h.slice(1),children:s(a,c)}):new C.ExternalHyperlink({link:h,children:s(a,c)})];case"footnoteReference":return[...d,new C.FootnoteReferenceRun((o=n[a.identifier].id)!=null?o:0)];case"fragment":return[...d,...s(a,c)];case"":return[...d];default:return console.warn(`Unsupported inline node type: ${a.type}`),[...d]}}))!=null?x:[]).flat()};return s},R=async(e,n,i,s)=>{var d;let{plugins:p,useTitle:I,...P}={...g,...s};for(let c of p)await((d=c.preprocess)==null?void 0:d.call(c,e,n));let x=_(n,i,p),a=(c,h)=>{var u;return(u=c.children)==null?void 0:u.map(r=>{var f,m,T,w;let o={...h},l=p.map(y=>{var D,S;return(S=(D=y.block)==null?void 0:D.call(y,v,r,o,a,x))!=null?S:[]}).flat();switch(Object.assign(o,r.data),r.type){case"paragraph":{let y=o.pre?{alignment:"left"}:{},D=typeof o.checked=="boolean"?[new C.CheckBox({checked:o.checked,checkedState:{value:"2611"},uncheckedState:{value:"2610"}}),new C.TextRun(" ")]:[];return[...l,new C.Paragraph({...y,...o,children:[...D,...x(r,o)]})]}case"heading":return[new C.Paragraph({...o,...l,heading:I?r.depth===1?"Title":`Heading${r.depth-1}`:`Heading${r.depth}`,children:[new C.Bookmark({id:O(r).replace(/[. ]+/g,"-").toLowerCase(),children:x(r,o)})]})];case"code":return[...l,new C.Paragraph({border:{bottom:{style:C.BorderStyle.SINGLE,space:5,size:1},left:{style:C.BorderStyle.SINGLE,space:10,size:1},right:{style:C.BorderStyle.SINGLE,space:5,size:1},top:{style:C.BorderStyle.SINGLE,space:6,size:1}},...o,alignment:"left",style:"blockCode",children:r.value.split(` | ||
`).map((y,D)=>new C.TextRun({...o,text:y,break:D===0?0:1,style:"code",font:{name:"Consolas"}}))})];case"list":return r.ordered?(o.bullet={level:((m=(f=o.bullet)==null?void 0:f.level)!=null?m:-1)+1},console.warn("Please add numbering plugin to support ordered lists. For now, we use only bullets for both the ordered and the unordered list.")):o.bullet={level:((w=(T=o.bullet)==null?void 0:T.level)!=null?w:-1)+1},[...l,...a(r,o)];case"blockquote":return[...l,...a(r,o)];case"listItem":return o.checked=r.checked,[...l,...a(r,o)];case"thematicBreak":return[...l,new C.Paragraph({...r.data,border:{top:{style:C.BorderStyle.SINGLE,size:6}}})];case"definition":case"footnoteDefinition":return l;case"table":return console.warn("Please add table plugin to support tables."),l;case"fragment":return[...l,...a(r,o)];case"":return l;case"yaml":case"html":default:return console.warn(`May be an unsupported node type: ${r.type}`,r),l}}).flat()};return{...P,children:a(e,{})}};var j=async(e,n={},i=g,s="blob")=>{var c;let p=1,I={},P={...N,...n};(c=i==null?void 0:i.plugins)==null||c.forEach(h=>{var u;return(u=h==null?void 0:h.root)==null?void 0:u.call(h,P)});let x=await Promise.all((Array.isArray(e)?e:[{ast:e}]).map(async({ast:h,props:u})=>{var l;let{definitions:r,footnoteDefinitions:o}=k(h.children);return await Promise.all(Object.values(o).map(async f=>{f.id=p,I[p]=await R({type:"root",children:f.children},r,{}),p++})),(l=u==null?void 0:u.plugins)==null||l.forEach(f=>{var m;return(m=f==null?void 0:f.root)==null?void 0:m.call(f,P)}),{ast:h,props:{...i,...u},definitions:r,footnoteDefinitions:o}})),a=await Promise.all(x.map(({ast:h,props:u,definitions:r,footnoteDefinitions:o})=>R(h,r,o,u))),d=new C.Document({...P,footnotes:I,sections:a});return C.Packer.pack(d,s)};0&&(module.exports={toDocx}); |
@@ -1,3 +0,3 @@ | ||
"use strict";var S=Object.create;var y=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var v=Object.getPrototypeOf,B=Object.prototype.hasOwnProperty;var F=(t,a)=>{for(var l in a)y(t,l,{get:a[l],enumerable:!0})},R=(t,a,l,p)=>{if(a&&typeof a=="object"||typeof a=="function")for(let d of E(a))!B.call(t,d)&&d!==l&&y(t,d,{get:()=>a[d],enumerable:!(p=M(a,d))||p.enumerable});return t};var H=(t,a,l)=>(l=t!=null?S(v(t)):{},R(a||!t||!t.__esModule?y(l,"default",{value:t,enumerable:!0}):l,t)),L=t=>R(y({},"__esModule",{value:!0}),t);var X={};F(X,{toSection:()=>U});module.exports=L(X);var w=require("docx");var D=t=>{var a,l;return(a=t.children)!=null&&a.length?t.children.map(D).join(""):(l=t.value)!=null?l:""},T={useTitle:!0,plugins:[]};var N=H(require("docx")),z=(t,a,l)=>{let p=(d,I={})=>{var m,h;return((h=(m=d.children)==null?void 0:m.map(n=>{var x,r,o;let c=l.map(s=>{var g,b;return(b=(g=s.inline)==null?void 0:g.call(s,N,n,I,t,a,p))!=null?b:[]}).flat(),i=Object.assign({},I,n.data),P=(r=n.url)!=null?r:t[(x=n.identifier)==null?void 0:x.toUpperCase()];switch(n.type){case"text":return[...c,...i.pre?n.value.split(` | ||
`).map(s=>new w.TextRun({text:s,...i,break:1})):[new w.TextRun({text:n.value,...i})]];case"checkbox":return[...c,new w.CheckBox({checked:!!n.checked})];case"break":return[...c,new w.TextRun({break:1})];case"inlineCode":return[...c,new w.TextRun({text:n.value,...i,style:"code",font:{name:"Consolas"}})];case"emphasis":return i.italics=!0,[...c,...p(n,i)];case"strong":return i.bold=!0,[...c,...p(n,i)];case"delete":return i.strike=!0,[...c,...p(n,i)];case"link":case"linkReference":return i.underline={},[...c,P.startsWith("#")?new w.InternalHyperlink({anchor:P.slice(1),children:p(n,i)}):new w.ExternalHyperlink({link:P,children:p(n,i)})];case"footnoteReference":return[...c,new w.FootnoteReferenceRun((o=a[n.identifier].id)!=null?o:0)];case"fragment":return[...c,...p(n,i)];case"":return[...c];default:return console.warn(`Unsupported inline node type: ${n.type}`),[...c]}}))!=null?h:[]).flat()};return p},U=async(t,a,l,p)=>{var c;let{plugins:d,useTitle:I,...m}={...T,...p};for(let i of d)await((c=i.preprocess)==null?void 0:c.call(i,t));let h=z(a,l,d),n=(i,P)=>{var x;return(x=i.children)==null?void 0:x.map(r=>{var g,b,C,k;let o={...P},s=d.map(u=>{var f,O;return(O=(f=u.block)==null?void 0:f.call(u,N,r,o,n,h))!=null?O:[]}).flat();switch(Object.assign(o,r.data),r.type){case"paragraph":{let u=o.pre?{alignment:"left"}:{},f=typeof o.checked=="boolean"?[new w.CheckBox({checked:o.checked,checkedState:{value:"2611"},uncheckedState:{value:"2610"}}),new w.TextRun(" ")]:[];return[...s,new w.Paragraph({...u,...o,children:[...f,...h(r,o)]})]}case"heading":return[new w.Paragraph({...o,...s,heading:I?r.depth===1?"Title":`Heading${r.depth-1}`:`Heading${r.depth}`,children:[new w.Bookmark({id:D(r).replace(/[. ]+/g,"-").toLowerCase(),children:h(r,o)})]})];case"code":return[...s,new w.Paragraph({border:{bottom:{style:w.BorderStyle.SINGLE,space:5,size:1},left:{style:w.BorderStyle.SINGLE,space:10,size:1},right:{style:w.BorderStyle.SINGLE,space:5,size:1},top:{style:w.BorderStyle.SINGLE,space:6,size:1}},...o,alignment:"left",style:"blockCode",children:r.value.split(` | ||
"use strict";var S=Object.create;var y=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var v=Object.getPrototypeOf,B=Object.prototype.hasOwnProperty;var F=(t,i)=>{for(var l in i)y(t,l,{get:i[l],enumerable:!0})},R=(t,i,l,p)=>{if(i&&typeof i=="object"||typeof i=="function")for(let d of E(i))!B.call(t,d)&&d!==l&&y(t,d,{get:()=>i[d],enumerable:!(p=M(i,d))||p.enumerable});return t};var H=(t,i,l)=>(l=t!=null?S(v(t)):{},R(i||!t||!t.__esModule?y(l,"default",{value:t,enumerable:!0}):l,t)),L=t=>R(y({},"__esModule",{value:!0}),t);var X={};F(X,{toSection:()=>U});module.exports=L(X);var w=require("docx");var D=t=>{var i,l;return(i=t.children)!=null&&i.length?t.children.map(D).join(""):(l=t.value)!=null?l:""},T={useTitle:!0,plugins:[]};var N=H(require("docx")),z=(t,i,l)=>{let p=(d,I={})=>{var m,h;return((h=(m=d.children)==null?void 0:m.map(n=>{var x,r,o;let c=l.map(s=>{var g,b;return(b=(g=s.inline)==null?void 0:g.call(s,N,n,I,t,i,p))!=null?b:[]}).flat(),a=Object.assign({},I,n.data),P=(r=n.url)!=null?r:t[(x=n.identifier)==null?void 0:x.toUpperCase()];switch(n.type){case"text":return[...c,...a.pre?n.value.split(` | ||
`).map(s=>new w.TextRun({text:s,...a,break:1})):[new w.TextRun({text:n.value,...a})]];case"checkbox":return[...c,new w.CheckBox({checked:!!n.checked})];case"break":return[...c,new w.TextRun({break:1})];case"inlineCode":return[...c,new w.TextRun({text:n.value,...a,style:"code",font:{name:"Consolas"}})];case"emphasis":return a.italics=!0,[...c,...p(n,a)];case"strong":return a.bold=!0,[...c,...p(n,a)];case"delete":return a.strike=!0,[...c,...p(n,a)];case"link":case"linkReference":return a.underline={},[...c,P.startsWith("#")?new w.InternalHyperlink({anchor:P.slice(1),children:p(n,a)}):new w.ExternalHyperlink({link:P,children:p(n,a)})];case"footnoteReference":return[...c,new w.FootnoteReferenceRun((o=i[n.identifier].id)!=null?o:0)];case"fragment":return[...c,...p(n,a)];case"":return[...c];default:return console.warn(`Unsupported inline node type: ${n.type}`),[...c]}}))!=null?h:[]).flat()};return p},U=async(t,i,l,p)=>{var c;let{plugins:d,useTitle:I,...m}={...T,...p};for(let a of d)await((c=a.preprocess)==null?void 0:c.call(a,t,i));let h=z(i,l,d),n=(a,P)=>{var x;return(x=a.children)==null?void 0:x.map(r=>{var g,b,C,k;let o={...P},s=d.map(u=>{var f,O;return(O=(f=u.block)==null?void 0:f.call(u,N,r,o,n,h))!=null?O:[]}).flat();switch(Object.assign(o,r.data),r.type){case"paragraph":{let u=o.pre?{alignment:"left"}:{},f=typeof o.checked=="boolean"?[new w.CheckBox({checked:o.checked,checkedState:{value:"2611"},uncheckedState:{value:"2610"}}),new w.TextRun(" ")]:[];return[...s,new w.Paragraph({...u,...o,children:[...f,...h(r,o)]})]}case"heading":return[new w.Paragraph({...o,...s,heading:I?r.depth===1?"Title":`Heading${r.depth-1}`:`Heading${r.depth}`,children:[new w.Bookmark({id:D(r).replace(/[. ]+/g,"-").toLowerCase(),children:h(r,o)})]})];case"code":return[...s,new w.Paragraph({border:{bottom:{style:w.BorderStyle.SINGLE,space:5,size:1},left:{style:w.BorderStyle.SINGLE,space:10,size:1},right:{style:w.BorderStyle.SINGLE,space:5,size:1},top:{style:w.BorderStyle.SINGLE,space:6,size:1}},...o,alignment:"left",style:"blockCode",children:r.value.split(` | ||
`).map((u,f)=>new w.TextRun({...o,text:u,break:f===0?0:1,style:"code",font:{name:"Consolas"}}))})];case"list":return r.ordered?(o.bullet={level:((b=(g=o.bullet)==null?void 0:g.level)!=null?b:-1)+1},console.warn("Please add numbering plugin to support ordered lists. For now, we use only bullets for both the ordered and the unordered list.")):o.bullet={level:((k=(C=o.bullet)==null?void 0:C.level)!=null?k:-1)+1},[...s,...n(r,o)];case"blockquote":return[...s,...n(r,o)];case"listItem":return o.checked=r.checked,[...s,...n(r,o)];case"thematicBreak":return[...s,new w.Paragraph({...r.data,border:{top:{style:w.BorderStyle.SINGLE,size:6}}})];case"definition":case"footnoteDefinition":return s;case"table":return console.warn("Please add table plugin to support tables."),s;case"fragment":return[...s,...n(r,o)];case"":return s;case"yaml":case"html":default:return console.warn(`May be an unsupported node type: ${r.type}`,r),s}}).flat()};return{...m,children:n(t,{})}};0&&(module.exports={toSection}); |
@@ -106,3 +106,3 @@ import { ExternalHyperlink, ImageRun, InternalHyperlink, IParagraphOptions, TextRun, Table, Paragraph, IRunOptions, IPropertiesOptions, Math as DOCXMath } from "docx"; | ||
*/ | ||
preprocess?: (tree: Root) => void | Promise<void>; | ||
preprocess?: (tree: Root, definitions: Definitions) => void | Promise<void>; | ||
} | ||
@@ -109,0 +109,0 @@ /** |
@@ -1,1 +0,1 @@ | ||
"use strict";var a=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var u=(t,e)=>{for(var n in e)a(t,n,{get:e[n],enumerable:!0})},P=(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=>P(a({},"__esModule",{value:!0}),t);var x={};u(x,{DEFAULT_SECTION_PROPS:()=>h,convertInchesToTwip:()=>i.convertInchesToTwip,convertMillimetersToTwip:()=>i.convertMillimetersToTwip,defaultDocxProps:()=>g,getDefinitions:()=>p,getTextContent:()=>s});module.exports=f(x);var i=require("docx"),p=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,p(o.children))}),{definitions:e,footnoteDefinitions:n}},s=t=>{var e,n;return(e=t.children)!=null&&e.length?t.children.map(s).join(""):(n=t.value)!=null?n:""},h={useTitle:!0,plugins:[]},g={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}); | ||
"use strict";var a=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var f=(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 P=t=>u(a({},"__esModule",{value:!0}),t);var x={};f(x,{DEFAULT_SECTION_PROPS:()=>h,convertInchesToTwip:()=>i.convertInchesToTwip,convertMillimetersToTwip:()=>i.convertMillimetersToTwip,defaultDocxProps:()=>g,getDefinitions:()=>s,getTextContent:()=>p});module.exports=P(x);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:""},h={useTitle:!0,plugins:[]},g={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}); |
@@ -5,3 +5,3 @@ { | ||
"private": false, | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Core engine to convert extended MDAST to DOCX. Supports plugins for footnotes, images, lists, tables, and more. Designed for seamless Markdown-to-DOCX conversion.", | ||
@@ -56,2 +56,3 @@ "license": "MPL-2.0", | ||
"devDependencies": { | ||
"@m2d/html": "^1.0.1", | ||
"@repo/eslint-config": "workspace:*", | ||
@@ -78,4 +79,3 @@ "@repo/typescript-config": "workspace:*", | ||
"dependencies": { | ||
"@m2d/html": "^1.0.1", | ||
"@m2d/mdast": "^0.1.4" | ||
"@m2d/mdast": "^0.1.6" | ||
}, | ||
@@ -100,2 +100,3 @@ "peerDependencies": { | ||
"docx", | ||
"docx-for-generative-ai", | ||
"markdown-to-docx", | ||
@@ -102,0 +103,0 @@ "mdast-to-docx", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
32882
0.17%2
-33.33%20
5.26%- Removed
- Removed
- Removed
- Removed
Updated