mdast2docx 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/README.md +242 -203
  2. package/dist/chunk-3ZZBJC3M.mjs +1 -0
  3. package/dist/chunk-GP6KO6J3.mjs +3 -0
  4. package/dist/{chunk-CRVVOUD7.mjs → chunk-GS5L4UWU.mjs} +1 -1
  5. package/dist/{chunk-MSGIMOZN.mjs → chunk-IW743AEN.mjs} +1 -1
  6. package/dist/chunk-M5XHL7AG.mjs +4 -0
  7. package/dist/chunk-QR3NYQYH.mjs +1 -0
  8. package/dist/chunk-YNJKJBFY.mjs +3 -0
  9. package/dist/{chunk-JOIHCSIR.mjs → chunk-Z5DPYROV.mjs} +1 -1
  10. package/dist/index.js +3 -2
  11. package/dist/index.mjs +1 -1
  12. package/dist/mdast.d.ts +1076 -0
  13. package/dist/mdast.js +1 -0
  14. package/dist/{multipart-parser-ECCTUILZ.mjs → multipart-parser-WKN2UV32.mjs} +1 -1
  15. package/dist/plugins/html.d.ts +1 -1
  16. package/dist/plugins/html.js +3 -5
  17. package/dist/plugins/html.mjs +1 -1
  18. package/dist/plugins/image.mjs +1 -1
  19. package/dist/plugins/index.js +2 -78
  20. package/dist/plugins/index.mjs +1 -1
  21. package/dist/plugins/list.js +1 -1
  22. package/dist/plugins/list.mjs +1 -1
  23. package/dist/plugins/math.js +1 -75
  24. package/dist/plugins/math.mjs +1 -1
  25. package/dist/plugins/node/index.mjs +1 -1
  26. package/dist/plugins/node/node-image.mjs +1 -1
  27. package/dist/plugins/table.mjs +1 -1
  28. package/dist/section.d.ts +1 -1
  29. package/dist/section.js +3 -2
  30. package/dist/section.mjs +1 -1
  31. package/dist/utils.d.ts +16 -6
  32. package/dist/utils.js +1 -1
  33. package/dist/utils.mjs +1 -1
  34. package/package.json +95 -94
  35. package/dist/chunk-35E6UZDH.mjs +0 -4
  36. package/dist/chunk-ALSMH2CW.mjs +0 -75
  37. package/dist/chunk-ECHPYCZC.mjs +0 -2
  38. package/dist/chunk-I5QUWH2X.mjs +0 -1
  39. package/dist/chunk-X6PWMGYB.mjs +0 -5
  40. package/dist/chunk-Z2MODMIK.mjs +0 -1
@@ -1 +1 @@
1
- import{a,b}from"../chunk-ALSMH2CW.mjs";import"../chunk-Z2MODMIK.mjs";import"../chunk-I5QUWH2X.mjs";export{b as mathPlugin,a as parseLatex};
1
+ import{a,b}from"../chunk-QR3NYQYH.mjs";import"../chunk-3ZZBJC3M.mjs";export{b as mathPlugin,a as parseLatex};
@@ -1 +1 @@
1
- import{a as o,b as r}from"../../chunk-35E6UZDH.mjs";import"../../chunk-JOIHCSIR.mjs";import"../../chunk-Z2MODMIK.mjs";import"../../chunk-I5QUWH2X.mjs";export{o as SUPPORTED_IMAGE_TYPES,r as nodeImagePlugin};
1
+ import{a as o,b as r}from"../../chunk-M5XHL7AG.mjs";import"../../chunk-Z5DPYROV.mjs";import"../../chunk-3ZZBJC3M.mjs";export{o as SUPPORTED_IMAGE_TYPES,r as nodeImagePlugin};
@@ -1 +1 @@
1
- import{a,b}from"../../chunk-35E6UZDH.mjs";import"../../chunk-JOIHCSIR.mjs";import"../../chunk-Z2MODMIK.mjs";import"../../chunk-I5QUWH2X.mjs";export{a as SUPPORTED_IMAGE_TYPES,b as nodeImagePlugin};
1
+ import{a,b}from"../../chunk-M5XHL7AG.mjs";import"../../chunk-Z5DPYROV.mjs";import"../../chunk-3ZZBJC3M.mjs";export{a as SUPPORTED_IMAGE_TYPES,b as nodeImagePlugin};
@@ -1 +1 @@
1
- import{a,b}from"../chunk-Q6Q2NBIZ.mjs";import"../chunk-I5QUWH2X.mjs";export{a as defaultTableOptions,b as tablePlugin};
1
+ import{a,b}from"../chunk-Q6Q2NBIZ.mjs";import"../chunk-3ZZBJC3M.mjs";export{a as defaultTableOptions,b as tablePlugin};
package/dist/section.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Root } from "mdast";
1
+ import type { Root } from "./mdast";
2
2
  import type { Definitions, FootnoteDefinitions, ISectionProps } from "./utils";
3
3
  import { Paragraph } from "docx";
4
4
  import * as docx from "docx";
package/dist/section.js CHANGED
@@ -1,2 +1,3 @@
1
- "use strict";var O=Object.create;var m=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var S=Object.getPrototypeOf,B=Object.prototype.hasOwnProperty;var v=(e,o)=>{for(var l in o)m(e,l,{get:o[l],enumerable:!0})},D=(e,o,l,f)=>{if(o&&typeof o=="object"||typeof o=="function")for(let a of N(o))!B.call(e,a)&&a!==l&&m(e,a,{get:()=>o[a],enumerable:!(f=M(o,a))||f.enumerable});return e};var E=(e,o,l)=>(l=e!=null?O(S(e)):{},D(o||!e||!e.__esModule?m(l,"default",{value:e,enumerable:!0}):l,e)),F=e=>D(m({},"__esModule",{value:!0}),e);var j={};v(j,{toSection:()=>X});module.exports=F(j);var R=require("docx");var y=e=>{var o,l;return(o=e.children)!=null&&o.length?e.children.map(y).join(""):(l=e.value)!=null?l:""};var k={useTitle:!0,plugins:[]};var T=E(require("docx")),H=(e,o,l)=>{let f=async(i,h)=>{var t,u,p;let s=Object.assign({},h),c=(await Promise.all(l.map(r=>{var P,x;return(x=(P=r.inline)==null?void 0:P.call(r,T,i,h,e,o,a))!=null?x:[]}))).flat(),d=(u=i.url)!=null?u:e[(t=i.identifier)==null?void 0:t.toUpperCase()];switch(i.type){case"text":return[...c,new R.TextRun({text:i.value,...s})];case"break":return[...c,new R.TextRun({break:1})];case"inlineCode":return[...c,new R.TextRun({text:i.value,...s,style:"code",font:{name:"Consolas"}})];case"emphasis":return s.italics=!0,[...c,...await a(i,s)];case"strong":return s.bold=!0,[...c,...await a(i,s)];case"delete":return s.strike=!0,[...c,...await a(i,s)];case"link":case"linkReference":return[...c,d.startsWith("#")?new R.InternalHyperlink({anchor:d.slice(1),children:await a(i,s)}):new R.ExternalHyperlink({link:d,children:await a(i,s)})];case"footnoteReference":return[...c,new R.FootnoteReferenceRun((p=o[i.identifier].id)!=null?p:0)];case"":return[...c];default:return console.warn(`Unsupported inline node type: ${i.type}`),[...c]}},a=async(i,h={})=>{var s,c;return(await Promise.all((c=(s=i.children)==null?void 0:s.map(d=>f(d,h)))!=null?c:[])).flat()};return a},X=async(e,o,l,f)=>{let{plugins:a,useTitle:i,...h}={...k,...f},s=H(o,l,a),c=async(t,u)=>{var P,x,b,C;let p=Object.assign({},u),r=(await Promise.all(a.map(g=>{var I,w;return(w=(I=g.block)==null?void 0:I.call(g,T,t,p,d,s))!=null?w:[]}))).flat();switch(t.type){case"root":return[...r,...await d(t,p)];case"paragraph":return[...r,new R.Paragraph({...u,children:await s(t)})];case"heading":return[new R.Paragraph({...r,heading:i?t.depth===1?"Title":`Heading${t.depth-1}`:`Heading${t.depth}`,children:[new R.Bookmark({id:y(t).replace(/[. ]+/g,"-").toLowerCase(),children:await s(t)})]})];case"code":return[...r,new R.Paragraph({alignment:"start",style:"blockCode",children:t.value.split(`
2
- `).map(g=>new R.TextRun({text:g,break:1,style:"code",font:{name:"Consolas"}}))})];case"list":return t.ordered?(p.bullet={level:((x=(P=p.bullet)==null?void 0:P.level)!=null?x:-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.")):p.bullet={level:((C=(b=p.bullet)==null?void 0:b.level)!=null?C:-1)+1},[...r,...await d(t,p)];case"blockquote":return[...r,...await d(t,p)];case"listItem":return[...r,...await d(t,p)];case"thematicBreak":return[...r,new R.Paragraph({border:{top:{style:R.BorderStyle.SINGLE,size:6}}})];case"definition":case"footnoteDefinition":return r;case"table":return console.warn("Please add table plugin to support tables."),r;case"":return r;case"yaml":case"html":default:return console.warn(`May be an unsupported node type: ${t.type}`,t),r}},d=async(t,u)=>{var p;return(await Promise.all((p=t.children)==null?void 0:p.map(r=>c(r,u)))).flat()};return{...h,children:await d(e,{})}};0&&(module.exports={toSection});
1
+ "use strict";var R=Object.create;var b=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var S=Object.getPrototypeOf,v=Object.prototype.hasOwnProperty;var E=(n,i)=>{for(var p in i)b(n,p,{get:i[p],enumerable:!0})},w=(n,i,p,f)=>{if(i&&typeof i=="object"||typeof i=="function")for(let c of M(i))!v.call(n,c)&&c!==p&&b(n,c,{get:()=>i[c],enumerable:!(f=N(i,c))||f.enumerable});return n};var B=(n,i,p)=>(p=n!=null?R(S(n)):{},w(i||!n||!n.__esModule?b(p,"default",{value:n,enumerable:!0}):p,n)),F=n=>w(b({},"__esModule",{value:!0}),n);var L={};E(L,{toSection:()=>z});module.exports=F(L);var T=require("docx");var g=n=>{var i,p;return(i=n.children)!=null&&i.length?n.children.map(g).join(""):(p=n.value)!=null?p:""};var D={useTitle:!0,plugins:[]};var O=B(require("docx")),H=(n,i,p)=>{let f=async(r,P)=>{var e,u,o;let s=(await Promise.all(p.map(a=>{var m,y;return(y=(m=a.inline)==null?void 0:m.call(a,O,r,P,n,i,c))!=null?y:[]}))).flat(),l=Object.assign({},P,r.data),d=(u=r.url)!=null?u:n[(e=r.identifier)==null?void 0:e.toUpperCase()];switch(r.type){case"text":return[...s,...l.pre?r.value.split(`
2
+ `).map(a=>new T.TextRun({text:a,...l,break:1})):[new T.TextRun({text:r.value,...l})]];case"checkbox":return[...s,new T.CheckBox({checked:!!r.checked})];case"break":return[...s,new T.TextRun({break:1})];case"inlineCode":return[...s,new T.TextRun({text:r.value,...l,style:"code",font:{name:"Consolas"}})];case"emphasis":return l.italics=!0,[...s,...await c(r,l)];case"strong":return l.bold=!0,[...s,...await c(r,l)];case"delete":return l.strike=!0,[...s,...await c(r,l)];case"link":case"linkReference":return l.underline={},[...s,d.startsWith("#")?new T.InternalHyperlink({anchor:d.slice(1),children:await c(r,l)}):new T.ExternalHyperlink({link:d,children:await c(r,l)})];case"footnoteReference":return[...s,new T.FootnoteReferenceRun((o=i[r.identifier].id)!=null?o:0)];case"fragment":return[...s,...await c(r,l)];case"":return[...s];default:return console.warn(`Unsupported inline node type: ${r.type}`),[...s]}},c=async(r,P={})=>{var s,l;return(await Promise.all((l=(s=r.children)==null?void 0:s.map(d=>f(d,P)))!=null?l:[])).flat()};return c},z=async(n,i,p,f)=>{let{plugins:c,useTitle:r,...P}={...D,...f};c.forEach(e=>{var u;return(u=e==null?void 0:e.preprocess)==null?void 0:u.call(e,n)});let s=H(i,p,c),l=async(e,u)=>{var m,y,I,k;let o={...u},a=(await Promise.all(c.map(h=>{var x,C;return(C=(x=h.block)==null?void 0:x.call(h,O,e,o,d,s))!=null?C:[]}))).flat();switch(Object.assign(o,e.data),e.type){case"paragraph":{let h=o.pre?{alignment:"left"}:{},x=typeof o.checked=="boolean"?[new T.CheckBox({checked:o.checked,checkedState:{value:"2611"},uncheckedState:{value:"2610"}}),new T.TextRun(" ")]:[];return[...a,new T.Paragraph({...h,...o,children:[...x,...await s(e,o)]})]}case"heading":return[new T.Paragraph({...o,...a,heading:r?e.depth===1?"Title":`Heading${e.depth-1}`:`Heading${e.depth}`,children:[new T.Bookmark({id:g(e).replace(/[. ]+/g,"-").toLowerCase(),children:await s(e,o)})]})];case"code":return[...a,new T.Paragraph({border:{bottom:{style:T.BorderStyle.SINGLE,space:5,size:1},left:{style:T.BorderStyle.SINGLE,space:10,size:1},right:{style:T.BorderStyle.SINGLE,space:5,size:1},top:{style:T.BorderStyle.SINGLE,space:6,size:1}},...o,alignment:"left",style:"blockCode",children:e.value.split(`
3
+ `).map((h,x)=>new T.TextRun({...o,text:h,break:x===0?0:1,style:"code",font:{name:"Consolas"}}))})];case"list":return e.ordered?(o.bullet={level:((y=(m=o.bullet)==null?void 0:m.level)!=null?y:-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=(I=o.bullet)==null?void 0:I.level)!=null?k:-1)+1},[...a,...await d(e,o)];case"blockquote":return[...a,...await d(e,o)];case"listItem":return o.checked=e.checked,[...a,...await d(e,o)];case"thematicBreak":return[...a,new T.Paragraph({...e.data,border:{top:{style:T.BorderStyle.SINGLE,size:6}}})];case"definition":case"footnoteDefinition":return a;case"table":return console.warn("Please add table plugin to support tables."),a;case"fragment":return[...a,...await d(e,o)];case"":return a;case"yaml":case"html":default:return console.warn(`May be an unsupported node type: ${e.type}`,e),a}},d=async(e,u)=>{var o;return(await Promise.all((o=e.children)==null?void 0:o.map(a=>l(a,u)))).flat()};return{...P,children:await d(n,{})}};0&&(module.exports={toSection});
package/dist/section.mjs CHANGED
@@ -1 +1 @@
1
- import{a}from"./chunk-ECHPYCZC.mjs";import"./chunk-MSGIMOZN.mjs";import"./chunk-I5QUWH2X.mjs";export{a as toSection};
1
+ import{a}from"./chunk-YNJKJBFY.mjs";import"./chunk-IW743AEN.mjs";import"./chunk-3ZZBJC3M.mjs";export{a as toSection};
package/dist/utils.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ExternalHyperlink, ImageRun, InternalHyperlink, IParagraphOptions, TextRun, Table, Paragraph, IRunOptions, IPropertiesOptions, Math as DOCXMath } from "docx";
2
2
  import * as DOCX from "docx";
3
- import { BlockContent, DefinitionContent, Parent, Root, RootContent } from "mdast";
3
+ import { BlockContent, Data, DefinitionContent, Parent, Root, RootContent } from "./mdast";
4
4
  export { convertInchesToTwip, convertMillimetersToTwip } from "docx";
5
5
  export type Optional<T> = {
6
6
  [K in keyof T]?: T[K];
@@ -30,9 +30,11 @@ export declare const getDefinitions: (nodes: RootContent[]) => {
30
30
  */
31
31
  type ExtendedRootContent<T extends {
32
32
  type: string;
33
+ data?: Data;
33
34
  } = {
34
35
  type: "";
35
- }> = RootContent | Root | T;
36
+ data: {};
37
+ }> = RootContent | T;
36
38
  /**
37
39
  * Extracts the textual content from a given MDAST node.
38
40
  * Recursively processes child nodes if present.
@@ -74,14 +76,19 @@ export declare const defaultDocxProps: IDocxProps;
74
76
  /**
75
77
  * Mutable version of IRunOptions where all properties are writable.
76
78
  */
77
- export type MutableRunOptions = Mutable<Omit<IRunOptions, "children">>;
79
+ export type MutableRunOptions = Mutable<Omit<IRunOptions, "children">> & {
80
+ pre?: boolean;
81
+ };
78
82
  export type InlineDocxNodes = TextRun | ImageRun | InternalHyperlink | ExternalHyperlink | DOCXMath;
79
83
  export type InlineProcessor = (node: ExtendedRootContent, runProps: MutableRunOptions) => Promise<InlineDocxNodes[]>;
80
84
  export type InlineChildrenProcessor = (node: Parent, runProps?: MutableRunOptions) => Promise<InlineDocxNodes[]>;
81
85
  /**
82
86
  * Mutable version of IParagraphOptions where all properties are writable.
83
87
  */
84
- export type MutableParaOptions = Omit<Mutable<IParagraphOptions>, "children">;
88
+ export type MutableParaOptions = Omit<Mutable<IParagraphOptions>, "children"> & {
89
+ checked?: boolean | null;
90
+ pre?: boolean;
91
+ };
85
92
  export type BlockNodeProcessor = (node: ExtendedRootContent, paraProps: MutableParaOptions) => Promise<(Paragraph | Table)[]>;
86
93
  export type BlockNodeChildrenProcessor = (node: Parent | Root, paraProps: MutableParaOptions) => Promise<(Paragraph | Table)[]>;
87
94
  /**
@@ -104,9 +111,12 @@ export interface IPlugin<T extends {
104
111
  * Allows plugins to modify document-level DOCX properties, such as styles, numbering, headers, and footers. This is useful for global formatting customizations.
105
112
  */
106
113
  root?: (props: IDocxProps) => void;
114
+ /**
115
+ * Preprocess mdast tree before conversion
116
+ */
117
+ preprocess?: (tree: Root) => void;
107
118
  }
108
- export declare const inlineMdastNodes: string[];
109
- export declare const standardize_color: (str: string) => string;
119
+ export declare const standardizeColor: (str: string) => string;
110
120
  /**
111
121
  * @mayank/docx is a fork of the `docx` library with minor modifications,
112
122
  * primarily adding exports for additional types missing from the original `docx` library.
package/dist/utils.js CHANGED
@@ -1 +1 @@
1
- "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 x=t=>u(a({},"__esModule",{value:!0}),t);var b={};f(b,{convertInchesToTwip:()=>i.convertInchesToTwip,convertMillimetersToTwip:()=>i.convertMillimetersToTwip,defaultDocxProps:()=>h,defaultSectionProps:()=>g,getDefinitions:()=>s,getTextContent:()=>p,inlineMdastNodes:()=>y,standardize_color:()=>D,uuid:()=>P});module.exports=x(b);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:""},P=()=>Math.random().toString(16).slice(2),g={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}}}}}},y=["text","break","inlineCode","image","emphasis","strong","delete","link","linkReference","footnoteReference"],D=t=>{let e=document.createElement("canvas").getContext("2d");return e?(e.fillStyle=t,e.fillStyle):t.startsWith("#")?t:"auto"};0&&(module.exports={convertInchesToTwip,convertMillimetersToTwip,defaultDocxProps,defaultSectionProps,getDefinitions,getTextContent,inlineMdastNodes,standardize_color,uuid});
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})},f=(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=>f(a({},"__esModule",{value:!0}),t);var b={};u(b,{convertInchesToTwip:()=>i.convertInchesToTwip,convertMillimetersToTwip:()=>i.convertMillimetersToTwip,defaultDocxProps:()=>h,defaultSectionProps:()=>g,getDefinitions:()=>s,getTextContent:()=>p,standardizeColor:()=>D,uuid:()=>x});module.exports=P(b);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=()=>Math.random().toString(16).slice(2),g={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}}}}}},D=t=>{let e=document.createElement("canvas").getContext("2d");return e?(e.fillStyle=t,e.fillStyle.slice(1)):t.startsWith("#")?t.slice(1):"auto"};0&&(module.exports={convertInchesToTwip,convertMillimetersToTwip,defaultDocxProps,defaultSectionProps,getDefinitions,getTextContent,standardizeColor,uuid});
package/dist/utils.mjs CHANGED
@@ -1 +1 @@
1
- import{a,b,c,d,e,f,g,h,i}from"./chunk-MSGIMOZN.mjs";import"./chunk-I5QUWH2X.mjs";export{h as convertInchesToTwip,i as convertMillimetersToTwip,e as defaultDocxProps,d as defaultSectionProps,a as getDefinitions,b as getTextContent,f as inlineMdastNodes,g as standardize_color,c as uuid};
1
+ import{a,b,c,d,e,f,g,h}from"./chunk-IW743AEN.mjs";import"./chunk-3ZZBJC3M.mjs";export{g as convertInchesToTwip,h as convertMillimetersToTwip,e as defaultDocxProps,d as defaultSectionProps,a as getDefinitions,b as getTextContent,f as standardizeColor,c as uuid};
package/package.json CHANGED
@@ -1,94 +1,95 @@
1
- {
2
- "name": "mdast2docx",
3
- "author": "Mayank Kumar Chaudhari <https://mayank-chaudhari.vercel.app>",
4
- "private": false,
5
- "version": "0.2.0",
6
- "description": "Convert Markdown Abstract Syntax Tree (MDAST) to DOCX seamlessly. Supports footnotes, images, links, and customizable document properties.",
7
- "license": "MPL-2.0",
8
- "main": "./dist/index.js",
9
- "module": "./dist/index.mjs",
10
- "types": "./dist/index.d.ts",
11
- "repository": "github:tiny-md/mdast2docx",
12
- "bugs": "https://github.com/tiny-md/mdast2docx/issues",
13
- "homepage": "https://github.com/tiny-md/mdast2docx/#readme",
14
- "sideEffects": false,
15
- "files": [
16
- "dist/**"
17
- ],
18
- "scripts": {
19
- "build": "tsup && tsc -p tsconfig-build.json && gzip -c dist/index.js | wc -c",
20
- "clean": "rm -rf dist",
21
- "dev": "tsup --watch && tsc -p tsconfig-build.json -w",
22
- "typecheck": "tsc --noEmit",
23
- "lint": "eslint src/",
24
- "lint:fix": "eslint src/ --fix",
25
- "test": "vitest run --coverage"
26
- },
27
- "devDependencies": {
28
- "@repo/eslint-config": "workspace:*",
29
- "@repo/typescript-config": "workspace:*",
30
- "@testing-library/react": "^16.2.0",
31
- "@types/mdast": "^4.0.4",
32
- "@types/node": "^22.13.10",
33
- "@unified-latex/unified-latex-types": "^1.8.0",
34
- "@unified-latex/unified-latex-util-parse": "^1.8.2",
35
- "@vitest/coverage-v8": "^3.0.8",
36
- "esbuild-plugin-rdi": "^0.0.0",
37
- "hast-util-from-html": "^2.0.3",
38
- "hast-util-to-mdast": "^10.1.2",
39
- "jsdom": "^26.0.0",
40
- "node-fetch": "^3.3.2",
41
- "remark-gfm": "^4.0.1",
42
- "remark-parse": "^11.0.0",
43
- "sharp": "0.33.5",
44
- "tsup": "^8.4.0",
45
- "typescript": "^5.8.2",
46
- "unified": "^11.0.5",
47
- "vite-tsconfig-paths": "^5.1.4",
48
- "vitest": "^3.0.8"
49
- },
50
- "peerDependencies": {
51
- "docx": "^9.3.0"
52
- },
53
- "funding": [
54
- {
55
- "type": "github",
56
- "url": "https://github.com/sponsors/tiny-md"
57
- },
58
- {
59
- "type": "github",
60
- "url": "https://github.com/sponsors/mayank1513"
61
- }
62
- ],
63
- "keywords": [
64
- "mdast",
65
- "markdown",
66
- "docx",
67
- "markdown-to-docx",
68
- "mdast-to-docx",
69
- "converter",
70
- "remark",
71
- "unified",
72
- "footnotes",
73
- "images",
74
- "hyperlinks",
75
- "text-processing",
76
- "document-generator",
77
- "typescript",
78
- "open-source",
79
- "modern",
80
- "customizable",
81
- "seamless-integration",
82
- "cutting-edge",
83
- "compatibility",
84
- "progressive",
85
- "frontend",
86
- "web-development",
87
- "document-generation",
88
- "rich-text",
89
- "export",
90
- "ms-word",
91
- "automation",
92
- "mayank1513"
93
- ]
94
- }
1
+ {
2
+ "name": "mdast2docx",
3
+ "author": "Mayank Kumar Chaudhari <https://mayank-chaudhari.vercel.app>",
4
+ "private": false,
5
+ "version": "0.3.0",
6
+ "description": "Convert Markdown Abstract Syntax Tree (MDAST) to DOCX seamlessly. Supports footnotes, images, links, and customizable document properties.",
7
+ "license": "MPL-2.0",
8
+ "main": "./dist/index.js",
9
+ "module": "./dist/index.mjs",
10
+ "types": "./dist/index.d.ts",
11
+ "repository": "github:tiny-md/mdast2docx",
12
+ "bugs": "https://github.com/tiny-md/mdast2docx/issues",
13
+ "homepage": "https://github.com/tiny-md/mdast2docx/#readme",
14
+ "sideEffects": false,
15
+ "files": [
16
+ "dist/**"
17
+ ],
18
+ "scripts": {
19
+ "build": "tsup && tsc -p tsconfig-build.json && gzip -c dist/index.js | wc -c",
20
+ "clean": "rm -rf dist",
21
+ "dev": "tsup --watch && tsc -p tsconfig-build.json -w",
22
+ "typecheck": "tsc --noEmit",
23
+ "lint": "eslint src/",
24
+ "lint:fix": "eslint src/ --fix",
25
+ "test": "vitest run --coverage"
26
+ },
27
+ "devDependencies": {
28
+ "@repo/eslint-config": "workspace:*",
29
+ "@repo/typescript-config": "workspace:*",
30
+ "@types/mdast": "^4.0.4",
31
+ "@types/node": "^22.13.11",
32
+ "@unified-latex/unified-latex-types": "^1.8.0",
33
+ "@vitest/coverage-v8": "^3.0.9",
34
+ "esbuild-plugin-rdi": "^0.0.0",
35
+ "jsdom": "^26.0.0",
36
+ "node-fetch": "^3.3.2",
37
+ "remark-gfm": "^4.0.1",
38
+ "remark-parse": "^11.0.0",
39
+ "sharp": "0.33.5",
40
+ "tsup": "^8.4.0",
41
+ "typescript": "^5.8.2",
42
+ "unified": "^11.0.5",
43
+ "unist": "^0.0.1",
44
+ "vite-tsconfig-paths": "^5.1.4",
45
+ "vitest": "^3.0.9"
46
+ },
47
+ "dependencies": {
48
+ "latex-math": "^0.0.1"
49
+ },
50
+ "peerDependencies": {
51
+ "docx": "^9.3.0"
52
+ },
53
+ "funding": [
54
+ {
55
+ "type": "github",
56
+ "url": "https://github.com/sponsors/tiny-md"
57
+ },
58
+ {
59
+ "type": "github",
60
+ "url": "https://github.com/sponsors/mayank1513"
61
+ }
62
+ ],
63
+ "keywords": [
64
+ "mdast",
65
+ "markdown",
66
+ "generative-ai",
67
+ "docx",
68
+ "markdown-to-docx",
69
+ "mdast-to-docx",
70
+ "converter",
71
+ "remark",
72
+ "unified",
73
+ "footnotes",
74
+ "images",
75
+ "hyperlinks",
76
+ "text-processing",
77
+ "document-generator",
78
+ "typescript",
79
+ "open-source",
80
+ "modern",
81
+ "customizable",
82
+ "seamless-integration",
83
+ "cutting-edge",
84
+ "compatibility",
85
+ "progressive",
86
+ "frontend",
87
+ "web-development",
88
+ "document-generation",
89
+ "rich-text",
90
+ "export",
91
+ "ms-word",
92
+ "automation",
93
+ "mayank1513"
94
+ ]
95
+ }