md2x 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 +43 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +128069 -0
- package/dist/md2x.mjs +128296 -0
- package/dist/renderer/puppeteer-render-worker.js +815 -0
- package/dist/renderer/puppeteer-render.html +2829 -0
- package/dist/themes/code-themes/business-contrast.json +31 -0
- package/dist/themes/code-themes/colorful.json +32 -0
- package/dist/themes/code-themes/cool-modern.json +31 -0
- package/dist/themes/code-themes/high-contrast.json +31 -0
- package/dist/themes/code-themes/light-clean.json +31 -0
- package/dist/themes/code-themes/warm-book.json +31 -0
- package/dist/themes/color-schemes/candy.json +34 -0
- package/dist/themes/color-schemes/cool.json +34 -0
- package/dist/themes/color-schemes/coral.json +34 -0
- package/dist/themes/color-schemes/dino.json +34 -0
- package/dist/themes/color-schemes/forest.json +34 -0
- package/dist/themes/color-schemes/garden.json +34 -0
- package/dist/themes/color-schemes/neutral.json +34 -0
- package/dist/themes/color-schemes/ocean.json +34 -0
- package/dist/themes/color-schemes/rainbow.json +43 -0
- package/dist/themes/color-schemes/sakura.json +34 -0
- package/dist/themes/color-schemes/sepia.json +34 -0
- package/dist/themes/color-schemes/space.json +34 -0
- package/dist/themes/color-schemes/starry.json +34 -0
- package/dist/themes/color-schemes/sunset.json +34 -0
- package/dist/themes/color-schemes/warm.json +34 -0
- package/dist/themes/font-config.json +184 -0
- package/dist/themes/layout-schemes/academic.json +40 -0
- package/dist/themes/layout-schemes/book.json +40 -0
- package/dist/themes/layout-schemes/document.json +40 -0
- package/dist/themes/layout-schemes/magazine.json +40 -0
- package/dist/themes/layout-schemes/student.json +40 -0
- package/dist/themes/layout-schemes/technical.json +40 -0
- package/dist/themes/presets/academic.json +24 -0
- package/dist/themes/presets/business.json +22 -0
- package/dist/themes/presets/candy.json +23 -0
- package/dist/themes/presets/century.json +22 -0
- package/dist/themes/presets/coral.json +22 -0
- package/dist/themes/presets/default.json +22 -0
- package/dist/themes/presets/dinosaur.json +23 -0
- package/dist/themes/presets/elegant.json +22 -0
- package/dist/themes/presets/forest.json +22 -0
- package/dist/themes/presets/garamond.json +22 -0
- package/dist/themes/presets/garden.json +23 -0
- package/dist/themes/presets/handwritten.json +23 -0
- package/dist/themes/presets/heiti.json +22 -0
- package/dist/themes/presets/magazine.json +24 -0
- package/dist/themes/presets/manuscript.json +22 -0
- package/dist/themes/presets/minimal.json +22 -0
- package/dist/themes/presets/mixed.json +24 -0
- package/dist/themes/presets/newspaper.json +24 -0
- package/dist/themes/presets/ocean.json +22 -0
- package/dist/themes/presets/palatino.json +22 -0
- package/dist/themes/presets/rainbow.json +23 -0
- package/dist/themes/presets/space.json +23 -0
- package/dist/themes/presets/starry.json +23 -0
- package/dist/themes/presets/sunset.json +22 -0
- package/dist/themes/presets/swiss.json +22 -0
- package/dist/themes/presets/technical.json +22 -0
- package/dist/themes/presets/typewriter.json +23 -0
- package/dist/themes/presets/verdana.json +22 -0
- package/dist/themes/presets/water.json +22 -0
- package/dist/themes/registry.json +270 -0
- package/dist/themes/table-styles/academic.json +30 -0
- package/dist/themes/table-styles/borderless.json +26 -0
- package/dist/themes/table-styles/compact.json +24 -0
- package/dist/themes/table-styles/grid.json +22 -0
- package/dist/themes/table-styles/high-contrast.json +22 -0
- package/dist/themes/table-styles/minimal-gray.json +26 -0
- package/dist/themes/table-styles/modern-tech.json +34 -0
- package/dist/themes/table-styles/professional.json +34 -0
- package/dist/themes/table-styles/zebra.json +22 -0
- package/dist/types/node/src/host/browser-renderer.d.ts +40 -0
- package/dist/types/node/src/host/node-exporter.d.ts +63 -0
- package/dist/types/node/src/host/node-platform.d.ts +30 -0
- package/dist/types/node/src/index.d.ts +8 -0
- package/dist/types/src/core/markdown-block-splitter.d.ts +16 -0
- package/dist/types/src/core/markdown-document.d.ts +286 -0
- package/dist/types/src/core/markdown-processor.d.ts +228 -0
- package/dist/types/src/core/viewer/viewer-controller.d.ts +85 -0
- package/dist/types/src/exporters/docx-blockquote-converter.d.ts +24 -0
- package/dist/types/src/exporters/docx-code-highlighter.d.ts +14 -0
- package/dist/types/src/exporters/docx-download.d.ts +27 -0
- package/dist/types/src/exporters/docx-exporter.d.ts +77 -0
- package/dist/types/src/exporters/docx-image-utils.d.ts +71 -0
- package/dist/types/src/exporters/docx-inline-converter.d.ts +124 -0
- package/dist/types/src/exporters/docx-list-converter.d.ts +50 -0
- package/dist/types/src/exporters/docx-math-converter.d.ts +11 -0
- package/dist/types/src/exporters/docx-table-converter.d.ts +22 -0
- package/dist/types/src/exporters/mml2omml.d.ts +2 -0
- package/dist/types/src/exporters/theme-to-docx.d.ts +144 -0
- package/dist/types/src/plugins/base-plugin.d.ts +67 -0
- package/dist/types/src/plugins/canvas-plugin.d.ts +9 -0
- package/dist/types/src/plugins/dot-plugin.d.ts +9 -0
- package/dist/types/src/plugins/html-plugin.d.ts +28 -0
- package/dist/types/src/plugins/index.d.ts +56 -0
- package/dist/types/src/plugins/infographic-plugin.d.ts +9 -0
- package/dist/types/src/plugins/mermaid-plugin.d.ts +9 -0
- package/dist/types/src/plugins/plugin-content-utils.d.ts +40 -0
- package/dist/types/src/plugins/plugin-html-utils.d.ts +23 -0
- package/dist/types/src/plugins/rehype-image-uri.d.ts +13 -0
- package/dist/types/src/plugins/remark-super-sub.d.ts +17 -0
- package/dist/types/src/plugins/remark-toc-filter.d.ts +10 -0
- package/dist/types/src/plugins/svg-plugin.d.ts +51 -0
- package/dist/types/src/plugins/vega-plugin.d.ts +10 -0
- package/dist/types/src/plugins/vegalite-plugin.d.ts +23 -0
- package/dist/types/src/types/cache.d.ts +85 -0
- package/dist/types/src/types/core.d.ts +99 -0
- package/dist/types/src/types/docx.d.ts +240 -0
- package/dist/types/src/types/index.d.ts +18 -0
- package/dist/types/src/types/messaging.d.ts +142 -0
- package/dist/types/src/types/platform.d.ts +203 -0
- package/dist/types/src/types/plugin.d.ts +101 -0
- package/dist/types/src/types/render.d.ts +57 -0
- package/dist/types/src/types/theme.d.ts +234 -0
- package/dist/types/src/types/toolbar.d.ts +53 -0
- package/dist/types/src/ui/popup/i18n-helpers.d.ts +21 -0
- package/dist/types/src/ui/popup/settings-tab.d.ts +56 -0
- package/dist/types/src/ui/popup/storage-helper.d.ts +12 -0
- package/dist/types/src/utils/fetch-utils.d.ts +12 -0
- package/dist/types/src/utils/hash.d.ts +17 -0
- package/dist/types/src/utils/html-sanitizer.d.ts +26 -0
- package/dist/types/src/utils/localization.d.ts +49 -0
- package/dist/types/src/utils/theme-manager.d.ts +152 -0
- package/dist/types/src/utils/theme-to-css.d.ts +171 -0
- package/package.json +47 -0
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "2.0.0",
|
|
3
|
+
"themes": [
|
|
4
|
+
{
|
|
5
|
+
"id": "default",
|
|
6
|
+
"file": "default.json",
|
|
7
|
+
"category": "classic",
|
|
8
|
+
"featured": true,
|
|
9
|
+
"order": 1
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"id": "academic",
|
|
13
|
+
"file": "academic.json",
|
|
14
|
+
"category": "classic",
|
|
15
|
+
"featured": true,
|
|
16
|
+
"order": 2
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"id": "business",
|
|
20
|
+
"file": "business.json",
|
|
21
|
+
"category": "classic",
|
|
22
|
+
"featured": true,
|
|
23
|
+
"order": 3
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"id": "manuscript",
|
|
27
|
+
"file": "manuscript.json",
|
|
28
|
+
"category": "classic",
|
|
29
|
+
"featured": false,
|
|
30
|
+
"order": 4
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"id": "newspaper",
|
|
34
|
+
"file": "newspaper.json",
|
|
35
|
+
"category": "classic",
|
|
36
|
+
"featured": false,
|
|
37
|
+
"order": 5
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"id": "palatino",
|
|
41
|
+
"file": "palatino.json",
|
|
42
|
+
"category": "reading",
|
|
43
|
+
"featured": true,
|
|
44
|
+
"order": 6
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"id": "garamond",
|
|
48
|
+
"file": "garamond.json",
|
|
49
|
+
"category": "reading",
|
|
50
|
+
"featured": true,
|
|
51
|
+
"order": 7
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"id": "typewriter",
|
|
55
|
+
"file": "typewriter.json",
|
|
56
|
+
"category": "reading",
|
|
57
|
+
"featured": true,
|
|
58
|
+
"order": 8
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"id": "elegant",
|
|
62
|
+
"file": "elegant.json",
|
|
63
|
+
"category": "reading",
|
|
64
|
+
"featured": true,
|
|
65
|
+
"order": 9
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"id": "technical",
|
|
69
|
+
"file": "technical.json",
|
|
70
|
+
"category": "modern",
|
|
71
|
+
"featured": true,
|
|
72
|
+
"order": 10
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"id": "swiss",
|
|
76
|
+
"file": "swiss.json",
|
|
77
|
+
"category": "modern",
|
|
78
|
+
"featured": true,
|
|
79
|
+
"order": 11
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"id": "minimal",
|
|
83
|
+
"file": "minimal.json",
|
|
84
|
+
"category": "modern",
|
|
85
|
+
"featured": true,
|
|
86
|
+
"order": 12
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"id": "magazine",
|
|
90
|
+
"file": "magazine.json",
|
|
91
|
+
"category": "creative",
|
|
92
|
+
"featured": true,
|
|
93
|
+
"order": 13
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"id": "century",
|
|
97
|
+
"file": "century.json",
|
|
98
|
+
"category": "creative",
|
|
99
|
+
"featured": true,
|
|
100
|
+
"order": 14
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"id": "handwritten",
|
|
104
|
+
"file": "handwritten.json",
|
|
105
|
+
"category": "creative",
|
|
106
|
+
"featured": true,
|
|
107
|
+
"order": 15
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"id": "verdana",
|
|
111
|
+
"file": "verdana.json",
|
|
112
|
+
"category": "creative",
|
|
113
|
+
"featured": true,
|
|
114
|
+
"order": 16
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"id": "heiti",
|
|
118
|
+
"file": "heiti.json",
|
|
119
|
+
"category": "chinese",
|
|
120
|
+
"featured": true,
|
|
121
|
+
"order": 17
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"id": "mixed",
|
|
125
|
+
"file": "mixed.json",
|
|
126
|
+
"category": "chinese",
|
|
127
|
+
"featured": false,
|
|
128
|
+
"order": 18
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"id": "water",
|
|
132
|
+
"file": "water.json",
|
|
133
|
+
"category": "chinese",
|
|
134
|
+
"featured": true,
|
|
135
|
+
"order": 19
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"id": "rainbow",
|
|
139
|
+
"file": "rainbow.json",
|
|
140
|
+
"category": "playful",
|
|
141
|
+
"featured": true,
|
|
142
|
+
"order": 20
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"id": "starry",
|
|
146
|
+
"file": "starry.json",
|
|
147
|
+
"category": "playful",
|
|
148
|
+
"featured": true,
|
|
149
|
+
"order": 21
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"id": "candy",
|
|
153
|
+
"file": "candy.json",
|
|
154
|
+
"category": "playful",
|
|
155
|
+
"featured": true,
|
|
156
|
+
"order": 22
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
"id": "dinosaur",
|
|
160
|
+
"file": "dinosaur.json",
|
|
161
|
+
"category": "playful",
|
|
162
|
+
"featured": true,
|
|
163
|
+
"order": 23
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
"id": "space",
|
|
167
|
+
"file": "space.json",
|
|
168
|
+
"category": "playful",
|
|
169
|
+
"featured": true,
|
|
170
|
+
"order": 24
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"id": "garden",
|
|
174
|
+
"file": "garden.json",
|
|
175
|
+
"category": "playful",
|
|
176
|
+
"featured": true,
|
|
177
|
+
"order": 25
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"id": "forest",
|
|
181
|
+
"file": "forest.json",
|
|
182
|
+
"category": "nature",
|
|
183
|
+
"featured": true,
|
|
184
|
+
"order": 26
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"id": "ocean",
|
|
188
|
+
"file": "ocean.json",
|
|
189
|
+
"category": "nature",
|
|
190
|
+
"featured": true,
|
|
191
|
+
"order": 27
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
"id": "coral",
|
|
195
|
+
"file": "coral.json",
|
|
196
|
+
"category": "nature",
|
|
197
|
+
"featured": true,
|
|
198
|
+
"order": 28
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
"id": "sunset",
|
|
202
|
+
"file": "sunset.json",
|
|
203
|
+
"category": "nature",
|
|
204
|
+
"featured": true,
|
|
205
|
+
"order": 29
|
|
206
|
+
}
|
|
207
|
+
],
|
|
208
|
+
"categories": {
|
|
209
|
+
"classic": {
|
|
210
|
+
"name": "经典文档",
|
|
211
|
+
"name_en": "Classic Document",
|
|
212
|
+
"description": "传统正式的文档风格,适合公文、报告、论文",
|
|
213
|
+
"description_en": "Traditional formal styles for official documents, reports, papers",
|
|
214
|
+
"order": 1
|
|
215
|
+
},
|
|
216
|
+
"reading": {
|
|
217
|
+
"name": "书籍阅读",
|
|
218
|
+
"name_en": "Book & Reading",
|
|
219
|
+
"description": "舒适的长文阅读体验,适合小说、杂志、博客",
|
|
220
|
+
"description_en": "Comfortable long-form reading for novels, magazines, blogs",
|
|
221
|
+
"order": 2
|
|
222
|
+
},
|
|
223
|
+
"modern": {
|
|
224
|
+
"name": "现代科技",
|
|
225
|
+
"name_en": "Modern Tech",
|
|
226
|
+
"description": "简洁现代的设计风格,适合技术文档、产品说明",
|
|
227
|
+
"description_en": "Clean modern design for technical docs and products",
|
|
228
|
+
"order": 3
|
|
229
|
+
},
|
|
230
|
+
"creative": {
|
|
231
|
+
"name": "创意表达",
|
|
232
|
+
"name_en": "Creative Expression",
|
|
233
|
+
"description": "富有个性的创意风格,适合博客、设计、创意写作",
|
|
234
|
+
"description_en": "Creative styles for blogs, design, creative writing",
|
|
235
|
+
"order": 4
|
|
236
|
+
},
|
|
237
|
+
"chinese": {
|
|
238
|
+
"name": "中文排版",
|
|
239
|
+
"name_en": "Chinese Typography",
|
|
240
|
+
"description": "专为中文优化的排版风格",
|
|
241
|
+
"description_en": "Typography optimized for Chinese content",
|
|
242
|
+
"order": 5
|
|
243
|
+
},
|
|
244
|
+
"playful": {
|
|
245
|
+
"name": "缤纷童趣",
|
|
246
|
+
"name_en": "Colorful & Playful",
|
|
247
|
+
"description": "活泼多彩的风格,适合学生作业、儿童内容",
|
|
248
|
+
"description_en": "Vibrant playful styles for students and kids",
|
|
249
|
+
"order": 6
|
|
250
|
+
},
|
|
251
|
+
"nature": {
|
|
252
|
+
"name": "自然色彩",
|
|
253
|
+
"name_en": "Nature Colors",
|
|
254
|
+
"description": "取自自然的配色,温暖舒适的视觉体验",
|
|
255
|
+
"description_en": "Nature-inspired colors for warm visual experience",
|
|
256
|
+
"order": 7
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
"recommendations": {
|
|
260
|
+
"default": "default",
|
|
261
|
+
"academic": "academic",
|
|
262
|
+
"business": "business",
|
|
263
|
+
"technical": "technical",
|
|
264
|
+
"reading": "garamond",
|
|
265
|
+
"book": "palatino",
|
|
266
|
+
"modern": "swiss",
|
|
267
|
+
"screen": "verdana",
|
|
268
|
+
"creative": "magazine"
|
|
269
|
+
}
|
|
270
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "academic",
|
|
3
|
+
"name": "学术风格",
|
|
4
|
+
"name_en": "Academic",
|
|
5
|
+
"description": "双线表头 + 单线分隔,适合论文和学术文档",
|
|
6
|
+
"description_en": "Double-line header + single-line separators, ideal for papers and academic documents",
|
|
7
|
+
"border": {
|
|
8
|
+
"headerTop": {
|
|
9
|
+
"width": "1.5pt",
|
|
10
|
+
"style": "double"
|
|
11
|
+
},
|
|
12
|
+
"headerBottom": {
|
|
13
|
+
"width": "1.5pt",
|
|
14
|
+
"style": "single"
|
|
15
|
+
},
|
|
16
|
+
"lastRowBottom": {
|
|
17
|
+
"width": "1.5pt",
|
|
18
|
+
"style": "single"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"header": {
|
|
22
|
+
"fontWeight": "bold"
|
|
23
|
+
},
|
|
24
|
+
"cell": {
|
|
25
|
+
"padding": "6pt"
|
|
26
|
+
},
|
|
27
|
+
"zebra": {
|
|
28
|
+
"enabled": false
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "borderless",
|
|
3
|
+
"name": "无边框",
|
|
4
|
+
"name_en": "Borderless",
|
|
5
|
+
"description": "仅表头有下边框",
|
|
6
|
+
"description_en": "Only header has bottom border",
|
|
7
|
+
"border": {
|
|
8
|
+
"headerBottom": {
|
|
9
|
+
"width": "2pt",
|
|
10
|
+
"style": "single"
|
|
11
|
+
},
|
|
12
|
+
"lastRowBottom": {
|
|
13
|
+
"width": "1pt",
|
|
14
|
+
"style": "single"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"header": {
|
|
18
|
+
"fontWeight": "bold"
|
|
19
|
+
},
|
|
20
|
+
"cell": {
|
|
21
|
+
"padding": "8pt"
|
|
22
|
+
},
|
|
23
|
+
"zebra": {
|
|
24
|
+
"enabled": false
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "compact",
|
|
3
|
+
"name": "紧凑型",
|
|
4
|
+
"name_en": "Compact",
|
|
5
|
+
"description": "小间距 + 细边框,适合数据密集型表格",
|
|
6
|
+
"description_en": "Small padding + thin borders, ideal for data-heavy tables",
|
|
7
|
+
"border": {
|
|
8
|
+
"all": {
|
|
9
|
+
"width": "0.5pt",
|
|
10
|
+
"style": "single"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"header": {
|
|
14
|
+
"fontWeight": "bold",
|
|
15
|
+
"fontSize": "10pt"
|
|
16
|
+
},
|
|
17
|
+
"cell": {
|
|
18
|
+
"padding": "4pt",
|
|
19
|
+
"fontSize": "10pt"
|
|
20
|
+
},
|
|
21
|
+
"zebra": {
|
|
22
|
+
"enabled": true
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "grid",
|
|
3
|
+
"name": "网格样式",
|
|
4
|
+
"name_en": "Grid Style",
|
|
5
|
+
"description": "完整边框,表头浅灰背景,斑马纹",
|
|
6
|
+
"description_en": "Full borders, light gray header, zebra stripes",
|
|
7
|
+
"border": {
|
|
8
|
+
"all": {
|
|
9
|
+
"width": "1pt",
|
|
10
|
+
"style": "single"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"header": {
|
|
14
|
+
"fontWeight": "bold"
|
|
15
|
+
},
|
|
16
|
+
"cell": {
|
|
17
|
+
"padding": "8pt"
|
|
18
|
+
},
|
|
19
|
+
"zebra": {
|
|
20
|
+
"enabled": true
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "high-contrast",
|
|
3
|
+
"name": "高对比度",
|
|
4
|
+
"name_en": "High Contrast",
|
|
5
|
+
"description": "黑白高对比 + 粗边框,适合打印和可访问性需求",
|
|
6
|
+
"description_en": "Black & white high contrast with thick borders, ideal for printing and accessibility",
|
|
7
|
+
"border": {
|
|
8
|
+
"all": {
|
|
9
|
+
"width": "2pt",
|
|
10
|
+
"style": "single"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"header": {
|
|
14
|
+
"fontWeight": "bold"
|
|
15
|
+
},
|
|
16
|
+
"cell": {
|
|
17
|
+
"padding": "8pt"
|
|
18
|
+
},
|
|
19
|
+
"zebra": {
|
|
20
|
+
"enabled": true
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "minimal-gray",
|
|
3
|
+
"name": "极简灰调",
|
|
4
|
+
"name_en": "Minimal Gray",
|
|
5
|
+
"description": "仅横向边框 + 灰色调 + 简洁美观",
|
|
6
|
+
"description_en": "Horizontal borders only + gray tones + clean look",
|
|
7
|
+
"border": {
|
|
8
|
+
"headerBottom": {
|
|
9
|
+
"width": "1.5pt",
|
|
10
|
+
"style": "single"
|
|
11
|
+
},
|
|
12
|
+
"rowBottom": {
|
|
13
|
+
"width": "1pt",
|
|
14
|
+
"style": "single"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"header": {
|
|
18
|
+
"fontWeight": "bold"
|
|
19
|
+
},
|
|
20
|
+
"cell": {
|
|
21
|
+
"padding": "8pt"
|
|
22
|
+
},
|
|
23
|
+
"zebra": {
|
|
24
|
+
"enabled": false
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "modern-tech",
|
|
3
|
+
"name": "现代科技",
|
|
4
|
+
"name_en": "Modern Tech",
|
|
5
|
+
"description": "蓝色主题 + 圆角边框,适合技术文档和产品说明",
|
|
6
|
+
"description_en": "Blue theme with rounded borders, ideal for tech docs and product guides",
|
|
7
|
+
"border": {
|
|
8
|
+
"headerTop": {
|
|
9
|
+
"width": "2pt",
|
|
10
|
+
"style": "single"
|
|
11
|
+
},
|
|
12
|
+
"headerBottom": {
|
|
13
|
+
"width": "2pt",
|
|
14
|
+
"style": "single"
|
|
15
|
+
},
|
|
16
|
+
"rowBottom": {
|
|
17
|
+
"width": "1pt",
|
|
18
|
+
"style": "single"
|
|
19
|
+
},
|
|
20
|
+
"lastRowBottom": {
|
|
21
|
+
"width": "2pt",
|
|
22
|
+
"style": "single"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"header": {
|
|
26
|
+
"fontWeight": "bold"
|
|
27
|
+
},
|
|
28
|
+
"cell": {
|
|
29
|
+
"padding": "10pt"
|
|
30
|
+
},
|
|
31
|
+
"zebra": {
|
|
32
|
+
"enabled": false
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "professional",
|
|
3
|
+
"name": "专业风格",
|
|
4
|
+
"name_en": "Professional",
|
|
5
|
+
"description": "粗表头边框 + 细分隔线",
|
|
6
|
+
"description_en": "Thick header border + thin separators",
|
|
7
|
+
"border": {
|
|
8
|
+
"headerTop": {
|
|
9
|
+
"width": "2pt",
|
|
10
|
+
"style": "single"
|
|
11
|
+
},
|
|
12
|
+
"headerBottom": {
|
|
13
|
+
"width": "2pt",
|
|
14
|
+
"style": "single"
|
|
15
|
+
},
|
|
16
|
+
"rowBottom": {
|
|
17
|
+
"width": "1pt",
|
|
18
|
+
"style": "single"
|
|
19
|
+
},
|
|
20
|
+
"lastRowBottom": {
|
|
21
|
+
"width": "2pt",
|
|
22
|
+
"style": "single"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"header": {
|
|
26
|
+
"fontWeight": "bold"
|
|
27
|
+
},
|
|
28
|
+
"cell": {
|
|
29
|
+
"padding": "8pt"
|
|
30
|
+
},
|
|
31
|
+
"zebra": {
|
|
32
|
+
"enabled": false
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "zebra",
|
|
3
|
+
"name": "斑马纹",
|
|
4
|
+
"name_en": "Zebra",
|
|
5
|
+
"description": "奇偶行不同背景色,无边框",
|
|
6
|
+
"description_en": "Alternating row colors, no borders",
|
|
7
|
+
"border": {
|
|
8
|
+
"headerBottom": {
|
|
9
|
+
"width": "1pt",
|
|
10
|
+
"style": "single"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"header": {
|
|
14
|
+
"fontWeight": "bold"
|
|
15
|
+
},
|
|
16
|
+
"cell": {
|
|
17
|
+
"padding": "8pt"
|
|
18
|
+
},
|
|
19
|
+
"zebra": {
|
|
20
|
+
"enabled": true
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser-based Renderer for Node (Puppeteer)
|
|
3
|
+
*
|
|
4
|
+
* Refactored to reuse the shared render-worker-core + renderers (same as VSCode/mobile),
|
|
5
|
+
* instead of inlining renderer implementations and loading CDN dependencies.
|
|
6
|
+
*
|
|
7
|
+
* The browser page is built by `node/build.mjs` into `node/dist/renderer/puppeteer-render.html`.
|
|
8
|
+
*/
|
|
9
|
+
import type { RendererThemeConfig } from '../../../src/types/index';
|
|
10
|
+
export interface RenderResult {
|
|
11
|
+
base64: string;
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
format: string;
|
|
15
|
+
}
|
|
16
|
+
export interface PdfOptions {
|
|
17
|
+
format?: 'A4' | 'Letter' | 'Legal' | 'A3' | 'A5';
|
|
18
|
+
landscape?: boolean;
|
|
19
|
+
margin?: {
|
|
20
|
+
top?: string;
|
|
21
|
+
bottom?: string;
|
|
22
|
+
left?: string;
|
|
23
|
+
right?: string;
|
|
24
|
+
};
|
|
25
|
+
printBackground?: boolean;
|
|
26
|
+
scale?: number;
|
|
27
|
+
displayHeaderFooter?: boolean;
|
|
28
|
+
headerTemplate?: string;
|
|
29
|
+
footerTemplate?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface BrowserRenderer {
|
|
32
|
+
initialize(): Promise<void>;
|
|
33
|
+
render(type: string, content: string | object, basePath?: string, themeConfig?: RendererThemeConfig | null): Promise<RenderResult | null>;
|
|
34
|
+
exportToPdf(html: string, css: string, options?: PdfOptions, basePath?: string): Promise<Buffer>;
|
|
35
|
+
close(): Promise<void>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Create a browser-based renderer using Puppeteer
|
|
39
|
+
*/
|
|
40
|
+
export declare function createBrowserRenderer(): Promise<BrowserRenderer | null>;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node DOCX Exporter
|
|
3
|
+
*
|
|
4
|
+
* Thin Node.js wrapper around the shared `src/exporters/docx-exporter.ts`.
|
|
5
|
+
* The Node provides:
|
|
6
|
+
* - A minimal Node PlatformAPI (resource/storage/file/document)
|
|
7
|
+
* - A Puppeteer-backed PluginRenderer for diagrams/HTML/SVG
|
|
8
|
+
*
|
|
9
|
+
* This keeps the Node behavior aligned with the VSCode extension implementation.
|
|
10
|
+
*/
|
|
11
|
+
import { type PdfOptions } from './browser-renderer';
|
|
12
|
+
export type Md2DocxOptions = {
|
|
13
|
+
theme?: string;
|
|
14
|
+
basePath?: string;
|
|
15
|
+
/** When true, horizontal rules (---, ***, ___) will be converted to page breaks (default: true) */
|
|
16
|
+
docxHrAsPageBreak?: boolean;
|
|
17
|
+
};
|
|
18
|
+
export type Md2PdfOptions = {
|
|
19
|
+
theme?: string;
|
|
20
|
+
basePath?: string;
|
|
21
|
+
pdf?: PdfOptions;
|
|
22
|
+
/** When true, horizontal rules (---, ***, ___) will be converted to page breaks */
|
|
23
|
+
pdfHrAsPageBreak?: boolean;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Node DOCX Exporter Class (public API used by node/src/host/index.ts)
|
|
27
|
+
*/
|
|
28
|
+
export declare class NodeDocxExporter {
|
|
29
|
+
/**
|
|
30
|
+
* Export markdown to DOCX buffer
|
|
31
|
+
*/
|
|
32
|
+
exportToBuffer(markdown: string, options?: Md2DocxOptions): Promise<Buffer>;
|
|
33
|
+
/**
|
|
34
|
+
* Export markdown file to DOCX file
|
|
35
|
+
*/
|
|
36
|
+
exportToFile(inputPath: string, outputPath: string, options?: Md2DocxOptions): Promise<void>;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Node PDF Exporter Class
|
|
40
|
+
*/
|
|
41
|
+
export declare class NodePdfExporter {
|
|
42
|
+
/**
|
|
43
|
+
* Export markdown to PDF buffer
|
|
44
|
+
*/
|
|
45
|
+
exportToBuffer(markdown: string, options?: Md2PdfOptions): Promise<Buffer>;
|
|
46
|
+
/**
|
|
47
|
+
* Export markdown file to PDF file
|
|
48
|
+
*/
|
|
49
|
+
exportToFile(inputPath: string, outputPath: string, options?: Md2PdfOptions): Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* Process markdown to HTML with diagram rendering
|
|
52
|
+
*/
|
|
53
|
+
private processMarkdownToHtml;
|
|
54
|
+
/**
|
|
55
|
+
* Process diagram code blocks and replace with rendered images
|
|
56
|
+
*/
|
|
57
|
+
private processDiagrams;
|
|
58
|
+
/**
|
|
59
|
+
* Decode HTML entities in code blocks
|
|
60
|
+
*/
|
|
61
|
+
private decodeHtmlEntities;
|
|
62
|
+
}
|
|
63
|
+
export default NodeDocxExporter;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal Node.js PlatformAPI implementation for reusing shared src/exporters.
|
|
3
|
+
*
|
|
4
|
+
* This powers `src/utils/theme-manager` + `src/exporters/docx-exporter` in the Node.
|
|
5
|
+
* It is intentionally small: only the parts used during DOCX export are implemented.
|
|
6
|
+
*/
|
|
7
|
+
import type { PlatformAPI } from '../../../src/types/index';
|
|
8
|
+
export type NodePlatformOutput = {
|
|
9
|
+
kind: 'buffer';
|
|
10
|
+
} | {
|
|
11
|
+
kind: 'file';
|
|
12
|
+
};
|
|
13
|
+
export type CreateNodePlatformOptions = {
|
|
14
|
+
/**
|
|
15
|
+
* Directory of the running Node module (e.g. node/dist when built).
|
|
16
|
+
* Used to locate the `themes/` assets.
|
|
17
|
+
*/
|
|
18
|
+
moduleDir: string;
|
|
19
|
+
selectedThemeId: string;
|
|
20
|
+
output: NodePlatformOutput;
|
|
21
|
+
/** Settings to pass to exporters via storage */
|
|
22
|
+
settings?: {
|
|
23
|
+
docxHrAsPageBreak?: boolean;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export type CreatedNodePlatform = {
|
|
27
|
+
platform: PlatformAPI;
|
|
28
|
+
getCapturedBuffer: () => Buffer | null;
|
|
29
|
+
};
|
|
30
|
+
export declare function createNodePlatform(options: CreateNodePlatformOptions): CreatedNodePlatform;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Md2DocxOptions, Md2PdfOptions } from './host/node-exporter';
|
|
2
|
+
export { NodeDocxExporter, NodePdfExporter } from './host/node-exporter';
|
|
3
|
+
export type { Md2DocxOptions, Md2PdfOptions } from './host/node-exporter';
|
|
4
|
+
export type { PdfOptions } from './host/browser-renderer';
|
|
5
|
+
export declare function markdownToDocxBuffer(markdown: string, options?: Md2DocxOptions): Promise<Buffer>;
|
|
6
|
+
export declare function markdownFileToDocxFile(inputPath: string, outputPath: string, options?: Md2DocxOptions): Promise<void>;
|
|
7
|
+
export declare function markdownToPdfBuffer(markdown: string, options?: Md2PdfOptions): Promise<Buffer>;
|
|
8
|
+
export declare function markdownFileToPdfFile(inputPath: string, outputPath: string, options?: Md2PdfOptions): Promise<void>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standalone markdown block splitter with no dependencies.
|
|
3
|
+
* Each block type has its own detection logic.
|
|
4
|
+
*/
|
|
5
|
+
export interface BlockWithLine {
|
|
6
|
+
content: string;
|
|
7
|
+
startLine: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Split markdown into semantic blocks with source line numbers.
|
|
11
|
+
*/
|
|
12
|
+
export declare function splitMarkdownIntoBlocksWithLines(markdown: string): BlockWithLine[];
|
|
13
|
+
/**
|
|
14
|
+
* Split markdown into semantic blocks.
|
|
15
|
+
*/
|
|
16
|
+
export declare function splitMarkdownIntoBlocks(markdown: string): string[];
|