mdast2docx 0.0.0-beta.0 → 0.1.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.
- package/README.md +203 -170
- package/dist/chunk-3ZZBJC3M.mjs +1 -0
- package/dist/chunk-7LR5HC5O.mjs +4 -0
- package/dist/chunk-7W4N3GRD.mjs +75 -0
- package/dist/chunk-GM6UUFDK.mjs +2 -0
- package/dist/chunk-TASCVLMX.mjs +1 -0
- package/dist/chunk-UXY5TDOP.mjs +1 -0
- package/dist/chunk-XIRSNIMN.mjs +1 -0
- package/dist/chunk-YKZOUIFR.mjs +1 -0
- package/dist/chunk-Z5DPYROV.mjs +31 -0
- package/dist/chunk-ZKNVKZAF.mjs +1 -0
- package/dist/index.d.ts +7 -8
- package/dist/index.js +2 -38
- package/dist/index.mjs +1 -1
- package/dist/multipart-parser-WKN2UV32.mjs +2 -0
- package/dist/plugins/html.d.ts +0 -0
- package/dist/plugins/html.js +1 -0
- package/dist/plugins/image.d.ts +37 -0
- package/dist/plugins/image.js +1 -0
- package/dist/plugins/image.mjs +1 -0
- package/dist/plugins/index.d.ts +4 -0
- package/dist/plugins/index.js +75 -0
- package/dist/plugins/index.mjs +1 -0
- package/dist/plugins/list.d.ts +57 -0
- package/dist/plugins/list.js +1 -0
- package/dist/plugins/list.mjs +1 -0
- package/dist/plugins/math.d.ts +11 -0
- package/dist/plugins/math.js +75 -0
- package/dist/plugins/math.mjs +1 -0
- package/dist/plugins/node-image.d.ts +27 -0
- package/dist/plugins/node-image.js +35 -0
- package/dist/plugins/node-image.mjs +1 -0
- package/dist/plugins/node.d.ts +1 -0
- package/dist/plugins/node.js +35 -0
- package/dist/plugins/node.mjs +1 -0
- package/dist/plugins/table.d.ts +26 -0
- package/dist/plugins/table.js +1 -0
- package/dist/plugins/table.mjs +1 -0
- package/dist/section.d.ts +9 -8
- package/dist/section.js +2 -38
- package/dist/section.mjs +1 -1
- package/dist/utils.d.ts +75 -20
- package/dist/utils.js +1 -37
- package/dist/utils.mjs +1 -1
- package/package.json +6 -20
- package/dist/chunk-KRMGJ4HN.mjs +0 -2
- package/dist/chunk-O6BHSWEF.mjs +0 -37
package/dist/utils.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a,b,c,d,e,f}from"./chunk-YKZOUIFR.mjs";import"./chunk-3ZZBJC3M.mjs";export{e as convertInchesToTwip,f as convertMillimetersToTwip,d as defaultProps,a as getDefinitions,b as getTextContent,c as uuid};
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "mdast2docx",
|
|
3
3
|
"author": "Mayank Kumar Chaudhari <https://mayank-chaudhari.vercel.app>",
|
|
4
4
|
"private": false,
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.1.0",
|
|
6
6
|
"description": "Convert Markdown Abstract Syntax Tree (MDAST) to DOCX seamlessly. Supports footnotes, images, links, and customizable document properties.",
|
|
7
7
|
"license": "MPL-2.0",
|
|
8
8
|
"main": "./dist/index.js",
|
|
@@ -25,42 +25,28 @@
|
|
|
25
25
|
"test": "vitest run --coverage"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@mayank1513/docx": "^9.2.0",
|
|
29
28
|
"@repo/eslint-config": "workspace:*",
|
|
30
29
|
"@repo/typescript-config": "workspace:*",
|
|
31
30
|
"@testing-library/react": "^16.2.0",
|
|
32
31
|
"@types/mdast": "^4.0.4",
|
|
33
32
|
"@types/node": "^22.13.10",
|
|
34
|
-
"@types
|
|
35
|
-
"@
|
|
36
|
-
"@vitejs/plugin-react": "^4.3.4",
|
|
33
|
+
"@unified-latex/unified-latex-types": "^1.8.0",
|
|
34
|
+
"@unified-latex/unified-latex-util-parse": "^1.8.2",
|
|
37
35
|
"@vitest/coverage-v8": "^3.0.8",
|
|
38
36
|
"esbuild-plugin-rdi": "^0.0.0",
|
|
39
|
-
"esbuild-plugin-react18": "0.2.6",
|
|
40
|
-
"esbuild-plugin-react18-css": "^0.0.4",
|
|
41
37
|
"jsdom": "^26.0.0",
|
|
42
|
-
"
|
|
43
|
-
"react-dom": "^19.0.0",
|
|
38
|
+
"node-fetch": "^3.3.2",
|
|
44
39
|
"remark-gfm": "^4.0.1",
|
|
45
40
|
"remark-parse": "^11.0.0",
|
|
41
|
+
"sharp": "0.33.5",
|
|
46
42
|
"tsup": "^8.4.0",
|
|
47
43
|
"typescript": "^5.8.2",
|
|
48
44
|
"unified": "^11.0.5",
|
|
49
45
|
"vite-tsconfig-paths": "^5.1.4",
|
|
50
46
|
"vitest": "^3.0.8"
|
|
51
47
|
},
|
|
52
|
-
"dependencies": {
|
|
53
|
-
"r18gs": "^3.0.1"
|
|
54
|
-
},
|
|
55
48
|
"peerDependencies": {
|
|
56
|
-
"@
|
|
57
|
-
"next": ">=10",
|
|
58
|
-
"react": ">=16.8"
|
|
59
|
-
},
|
|
60
|
-
"peerDependenciesMeta": {
|
|
61
|
-
"next": {
|
|
62
|
-
"optional": true
|
|
63
|
-
}
|
|
49
|
+
"@mayank1513/docx": "^9.2.0"
|
|
64
50
|
},
|
|
65
51
|
"funding": [
|
|
66
52
|
{
|
package/dist/chunk-KRMGJ4HN.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as w,b as p,e as f,f as k,g as I,h as y,j as g,n as R}from"./chunk-O6BHSWEF.mjs";var b=(h,m,u)=>{let d=async(t,i)=>{var r,o,s;let n=new Set(i),c={bold:i.has("strong"),italics:i.has("emphasis"),strike:i.has("delete")},a=(o=t.url)!=null?o:h[(r=t.identifier)==null?void 0:r.toUpperCase()],e=(s=t.alt)!=null?s:a==null?void 0:a.split("/").pop();switch(t.type){case"text":return[new p({text:t.value,...c})];case"break":return[new p({break:1})];case"inlineCode":return[new p({text:t.value,...c,style:"code"})];case"emphasis":case"strong":case"delete":return n.add(t.type),l(t,n);case"link":case"linkReference":return n.add("link"),[a.startsWith("#")?new k({anchor:a,children:await l(t,n)}):new I({link:a,children:await l(t,n)})];case"image":case"imageReference":return[new f({...await u(a),altText:{description:e,name:e,title:e}})];case"footnoteReference":return[new g(m[t.identifier].id)];default:return[new p("")]}},l=async(t,i=new Set)=>{var n;return(await Promise.all((n=t.children)==null?void 0:n.map(c=>d(c,i)))).flat()};return l},S=async(h,m,u,d)=>{let{imageResolver:l,useTitle:t,...i}={...R,...d},n=b(m,u,l),c=async(e,r)=>{let o=[...r],s={};switch(r.includes("list")&&(s.bullet={level:r.filter(P=>P==="list").length-1}),r.includes("blockquote")&&(s.style="Quote"),e.type){case"paragraph":return[new y({...s,children:await n(e)})];case"heading":return[new y({heading:t?e.depth===1?"Title":`Heading${e.depth-1}`:`Heading${e.depth}`,children:await n(e)})];case"code":return[new y({alignment:"start",style:"blockCode",children:e.value.split(`
|
|
2
|
-
`).map(P=>new p({text:P,break:1,style:"code"}))})];case"list":case"blockquote":case"listItem":return o.push(e.type),a(e,o);case"thematicBreak":return[new y({border:{top:{style:w.SINGLE,size:6}}})];case"table":case"tableRow":case"tableCell":case"yaml":case"html":default:return console.warn(`Unsupported node type: ${e.type}`,e),[]}},a=async(e,r)=>{var o;return(await Promise.all((o=e.children)==null?void 0:o.map(s=>c(s,r)))).flat()};return{...i,children:await a(h,[])}};export{S as a};
|