@v1hz/md2docx 2.2.0 → 2.4.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 +102 -55
- package/config/config.json +5 -0
- package/config/config.schema.json +26 -0
- package/config/lua/limit-image-size.lua +93 -0
- package/config/style-config.json +20 -0
- package/config/style-config.schema.json +68 -0
- package/config/{style.json → style-raw.json} +14 -14
- package/dist/index.js +445 -75
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,18 +17,19 @@
|
|
|
17
17
|
|
|
18
18
|
## 功能
|
|
19
19
|
|
|
20
|
-
| 功能 | 说明
|
|
21
|
-
| ----------------- |
|
|
22
|
-
| 文档标题 | 从 YAML frontmatter、H1 或文件名提取标题
|
|
23
|
-
| 标题层级归一化 | 将最浅标题归一化为 H1,并修复标题层级跳跃
|
|
24
|
-
| 标题编号 | 生成 `1`、`1.1`、`1.1.1` 等编号,并可剥离常见的已有中英文编号
|
|
25
|
-
| 表格与图片编号 | 自动生成“表 1”“图 1:标题”等题注
|
|
26
|
-
|
|
|
27
|
-
|
|
|
28
|
-
|
|
|
29
|
-
|
|
|
30
|
-
|
|
|
31
|
-
|
|
|
20
|
+
| 功能 | 说明 |
|
|
21
|
+
| ----------------- | ---------------------------------------------------------------- |
|
|
22
|
+
| 文档标题 | 从 YAML frontmatter、H1 或文件名提取标题 |
|
|
23
|
+
| 标题层级归一化 | 将最浅标题归一化为 H1,并修复标题层级跳跃 |
|
|
24
|
+
| 标题编号 | 生成 `1`、`1.1`、`1.1.1` 等编号,并可剥离常见的已有中英文编号 |
|
|
25
|
+
| 表格与图片编号 | 自动生成“表 1”“图 1:标题”等题注 |
|
|
26
|
+
| 图片尺寸限制 | 按自然尺寸等比缩小超过最大宽度或高度的图片 |
|
|
27
|
+
| Mermaid 图表 | 使用 beautiful-mermaid 和 resvg-wasm 将 Mermaid 渲染为高 DPI PNG |
|
|
28
|
+
| Word 样式 | 支持受控语义化配置和完整底层样式,也可从现有 DOCX 提取样式 |
|
|
29
|
+
| Markdown 格式化 | 可只运行预处理流水线,输出格式化后的 Markdown |
|
|
30
|
+
| 去除分隔符 | 默认移除 `---`、`***`、`___` 等分隔符行,减少无用页面间距 |
|
|
31
|
+
| 集中缓存 | 中间文件统一存储到 `~/.md2docx/`,不会在当前目录创建 `tmp/` |
|
|
32
|
+
| Node 与可执行版本 | 支持 npm CLI,也支持构建不依赖 Node.js/Bun 的 Windows 可执行文件 |
|
|
32
33
|
|
|
33
34
|
## 安装方式
|
|
34
35
|
|
|
@@ -37,7 +38,7 @@
|
|
|
37
38
|
前置依赖:
|
|
38
39
|
|
|
39
40
|
- [Node.js 22.12+](https://nodejs.org/)
|
|
40
|
-
- [Pandoc](https://pandoc.org/installing.html),并确保 `pandoc` 可通过 `PATH`
|
|
41
|
+
- [Pandoc](https://pandoc.org/installing.html),并确保 `pandoc` 可通过 `PATH` 调用;图片尺寸限制需要 Pandoc 3.1.13+
|
|
41
42
|
|
|
42
43
|
```bash
|
|
43
44
|
npm install -g @v1hz/md2docx
|
|
@@ -58,26 +59,27 @@ npx @v1hz/md2docx report.md
|
|
|
58
59
|
md2docx report.md
|
|
59
60
|
|
|
60
61
|
# 使用任何转换选项时,输入必须通过 --file 指定
|
|
61
|
-
md2docx --file report.md --output output/report.docx
|
|
62
|
+
md2docx --file report.md --output output/report.docx
|
|
62
63
|
|
|
63
|
-
#
|
|
64
|
-
md2docx -f report.md -c config.json -
|
|
64
|
+
# 使用自定义配置、底层样式和语义化样式配置
|
|
65
|
+
md2docx -f report.md -c config.json --style-raw style-raw.json --style-config style-config.json
|
|
65
66
|
|
|
66
67
|
# 只执行 Markdown 预处理
|
|
67
68
|
md2docx format -f report.md
|
|
68
69
|
|
|
69
|
-
#
|
|
70
|
+
# 导出内置默认配置、底层样式和语义化样式配置
|
|
70
71
|
md2docx export config
|
|
71
|
-
md2docx export style
|
|
72
|
+
md2docx export style-raw
|
|
73
|
+
md2docx export style-config
|
|
72
74
|
|
|
73
75
|
# 从现有 DOCX 提取样式
|
|
74
|
-
md2docx export style -f template.docx
|
|
76
|
+
md2docx export style-raw -f template.docx
|
|
75
77
|
|
|
76
78
|
# 删除 ~/.md2docx 中的中间文件和缓存
|
|
77
79
|
md2docx clean
|
|
78
80
|
```
|
|
79
81
|
|
|
80
|
-
|
|
82
|
+
所有写文件命令默认覆盖已有输出。
|
|
81
83
|
|
|
82
84
|
## CLI 参考
|
|
83
85
|
|
|
@@ -86,29 +88,30 @@ md2docx <markdown>
|
|
|
86
88
|
md2docx -f <markdown> [转换选项]
|
|
87
89
|
md2docx format -f <markdown> [选项]
|
|
88
90
|
md2docx export config [选项]
|
|
89
|
-
md2docx export style [选项]
|
|
91
|
+
md2docx export style-raw [选项]
|
|
92
|
+
md2docx export style-config [选项]
|
|
90
93
|
md2docx clean
|
|
91
94
|
```
|
|
92
95
|
|
|
93
96
|
### 转换
|
|
94
97
|
|
|
95
|
-
| 参数
|
|
96
|
-
|
|
|
97
|
-
| `<markdown>`
|
|
98
|
-
| `-f, --file <path>`
|
|
99
|
-
| `-c, --config <path>`
|
|
100
|
-
|
|
|
101
|
-
|
|
|
102
|
-
|
|
|
103
|
-
| `-h, --help`
|
|
104
|
-
| `-v, --version`
|
|
98
|
+
| 参数 | 说明 |
|
|
99
|
+
| ----------------------- | ---------------------------------------- |
|
|
100
|
+
| `<markdown>` | 位置参数;仅在没有其他转换选项时允许使用 |
|
|
101
|
+
| `-f, --file <path>` | Markdown 输入文件 |
|
|
102
|
+
| `-c, --config <path>` | 自定义配置 JSON |
|
|
103
|
+
| `--style-raw <path>` | 完整底层 Word 样式 JSON |
|
|
104
|
+
| `--style-config <path>` | 受控语义化样式配置 JSON |
|
|
105
|
+
| `-o, --output <path>` | DOCX 输出路径 |
|
|
106
|
+
| `-h, --help` | 显示帮助 |
|
|
107
|
+
| `-v, --version` | 显示版本号 |
|
|
105
108
|
|
|
106
|
-
位置参数不能和 `--file`、`--config`、`--style`、`--
|
|
109
|
+
位置参数不能和 `--file`、`--config`、`--style-raw`、`--style-config` 或 `--output` 混用。例如:
|
|
107
110
|
|
|
108
111
|
```bash
|
|
109
112
|
md2docx report.md # 正确
|
|
110
|
-
md2docx report.md
|
|
111
|
-
md2docx -f report.md
|
|
113
|
+
md2docx report.md -o report.docx # 错误
|
|
114
|
+
md2docx -f report.md -o report.docx # 正确
|
|
112
115
|
```
|
|
113
116
|
|
|
114
117
|
### format
|
|
@@ -120,16 +123,16 @@ md2docx -f report.md --force # 正确
|
|
|
120
123
|
| `-f, --file <path>` | 必填,Markdown 输入文件 |
|
|
121
124
|
| `-c, --config <path>` | 自定义配置 JSON |
|
|
122
125
|
| `-o, --output <path>` | 输出 Markdown,默认 `<文件名>_formatted.md` |
|
|
123
|
-
| `--force` | 覆盖已有输出 |
|
|
124
126
|
|
|
125
127
|
### export
|
|
126
128
|
|
|
127
129
|
```bash
|
|
128
|
-
md2docx export config [-o config.json]
|
|
129
|
-
md2docx export style [-f template.docx] [-o style.json]
|
|
130
|
+
md2docx export config [-o config.json]
|
|
131
|
+
md2docx export style-raw [-f template.docx] [-o style-raw.json]
|
|
132
|
+
md2docx export style-config [-o style-config.json]
|
|
130
133
|
```
|
|
131
134
|
|
|
132
|
-
`export config`
|
|
135
|
+
`export config` 导出内置 Markdown 处理配置。`export style-raw` 不带 `--file` 时导出内置底层 Word 样式;指定 DOCX 时从该文档提取底层样式。`export style-config` 导出默认语义化样式配置。
|
|
133
136
|
|
|
134
137
|
### clean
|
|
135
138
|
|
|
@@ -153,8 +156,9 @@ md2docx report.md → ./report.docx
|
|
|
153
156
|
md2docx -f report.md → ./report.docx
|
|
154
157
|
md2docx format -f report.md → ./report_formatted.md
|
|
155
158
|
md2docx export config → ./config.json
|
|
156
|
-
md2docx export style → ./style.json
|
|
157
|
-
md2docx export style -f template.docx → ./template_style.json
|
|
159
|
+
md2docx export style-raw → ./style-raw.json
|
|
160
|
+
md2docx export style-raw -f template.docx → ./template_style-raw.json
|
|
161
|
+
md2docx export style-config → ./style-config.json
|
|
158
162
|
```
|
|
159
163
|
|
|
160
164
|
## 中间文件与缓存
|
|
@@ -169,8 +173,10 @@ md2docx export style -f template.docx → ./template_style.json
|
|
|
169
173
|
│ └── mermaid_*.png
|
|
170
174
|
├── resources/
|
|
171
175
|
│ ├── config.json
|
|
172
|
-
│ ├── style.json
|
|
173
|
-
│
|
|
176
|
+
│ ├── style-config.json
|
|
177
|
+
│ ├── style-raw.json
|
|
178
|
+
│ ├── add-inline-code.lua
|
|
179
|
+
│ └── limit-image-size.lua
|
|
174
180
|
└── style/
|
|
175
181
|
└── <样式内容哈希>.docx
|
|
176
182
|
```
|
|
@@ -209,20 +215,69 @@ CLI 不支持覆盖单个配置项,所有配置都通过 JSON 文件管理。
|
|
|
209
215
|
| `renderMermaid.enabled` | 将 Mermaid 渲染为 PNG | `true` |
|
|
210
216
|
| `renderMermaid.theme` | beautiful-mermaid 主题 | `"tokyo-night-light"` |
|
|
211
217
|
| `renderMermaid.density` | PNG 输出 DPI,最小值 72 | `200` |
|
|
218
|
+
| `imageSize.enabled` | 等比缩小超过尺寸限制的图片 | `true` |
|
|
219
|
+
| `imageSize.maxWidthCm` | DOCX 图片最大宽度(厘米) | `15.5` |
|
|
220
|
+
| `imageSize.maxHeightCm` | DOCX 图片最大高度(厘米) | `22` |
|
|
212
221
|
| `removeThematicBreaks.enabled` | 移除 `---`、`***`、`___` 等分隔符行 | `true` |
|
|
213
222
|
|
|
223
|
+
图片尺寸限制在 Pandoc 生成 DOCX 前通过 Lua filter 应用。程序读取图片像素尺寸和 DPI,仅缩小超限图片,不会放大小图;宽度和高度使用同一缩放比例。Markdown 中已经显式设置 `width` 或 `height` 的图片视为用户覆盖,不应用全局限制。单张图片无法读取尺寸时会输出警告并继续转换。
|
|
224
|
+
|
|
214
225
|
## 样式定制
|
|
215
226
|
|
|
216
|
-
|
|
227
|
+
普通用户推荐使用受控的语义化样式配置,只修改程序明确开放的高频选项。其余颜色、尺寸、对齐方式、间距和 Word 样式继承关系继续由内置预设管理。
|
|
228
|
+
|
|
229
|
+
仓库中的 `config/style-config.json` 是可直接复制和修改的默认配置,`config/style-config.schema.json` 用于编辑器提示和校验。完整底层 Word 样式位于 `config/style-raw.json`。
|
|
230
|
+
|
|
231
|
+
```json
|
|
232
|
+
{
|
|
233
|
+
"$schema": "https://raw.githubusercontent.com/WXY-V1hZ/md2docx/main/config/style-config.schema.json",
|
|
234
|
+
"schemaVersion": 1,
|
|
235
|
+
"options": {
|
|
236
|
+
"body": {
|
|
237
|
+
"firstLineIndent": false
|
|
238
|
+
},
|
|
239
|
+
"headings": {
|
|
240
|
+
"1": {
|
|
241
|
+
"startOnNewPage": false
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
"inlineCode": {
|
|
245
|
+
"background": false
|
|
246
|
+
},
|
|
247
|
+
"codeBlock": {
|
|
248
|
+
"border": false
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
将配置保存为 `style-config.json` 后使用:
|
|
255
|
+
|
|
256
|
+
```bash
|
|
257
|
+
md2docx -f report.md --style-config style-config.json
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
字段缺失表示继承底层样式;`true` 表示显式启用完整效果;`false` 表示显式关闭。当前只开放正文首行缩进、一级标题另起一页、行内代码背景和代码块外框。完整设计见 [`docs/style-config-design.md`](docs/style-config-design.md)。
|
|
261
|
+
|
|
262
|
+
转换时按以下规则选择输入:
|
|
263
|
+
|
|
264
|
+
| 参数 | 行为 |
|
|
265
|
+
| ------------------- | ----------------------------------- |
|
|
266
|
+
| 都不指定 | 默认 raw + 默认 config |
|
|
267
|
+
| 仅 `--style-raw` | 直接使用用户 raw,不应用默认 config |
|
|
268
|
+
| 仅 `--style-config` | 用户 config 应用到默认 raw |
|
|
269
|
+
| 两者都指定 | 用户 config 应用到用户 raw |
|
|
270
|
+
|
|
271
|
+
最终有效的底层样式用于生成 reference DOCX,并通过 Pandoc 的 `--reference-doc` 应用。`--style-raw` 和 `--style-config` 类型固定,不能互换。
|
|
217
272
|
|
|
218
273
|
### 从现有 DOCX 提取
|
|
219
274
|
|
|
220
275
|
```bash
|
|
221
|
-
md2docx export style -f template.docx
|
|
222
|
-
md2docx -f report.md -
|
|
276
|
+
md2docx export style-raw -f template.docx
|
|
277
|
+
md2docx -f report.md --style-raw template_style-raw.json
|
|
223
278
|
```
|
|
224
279
|
|
|
225
|
-
###
|
|
280
|
+
### 高级手动维护
|
|
226
281
|
|
|
227
282
|
主要区域包括:
|
|
228
283
|
|
|
@@ -286,7 +341,7 @@ numberPictures()
|
|
|
286
341
|
↓
|
|
287
342
|
生成或复用 reference DOCX
|
|
288
343
|
↓
|
|
289
|
-
Pandoc + Lua filter
|
|
344
|
+
Pandoc + 行内代码/图片尺寸 Lua filter
|
|
290
345
|
↓
|
|
291
346
|
DOCX
|
|
292
347
|
```
|
|
@@ -349,14 +404,6 @@ pandoc --version
|
|
|
349
404
|
|
|
350
405
|
如果命令不存在,请从 [Pandoc 官方安装页](https://pandoc.org/installing.html) 安装,并重新打开终端使 `PATH` 生效。
|
|
351
406
|
|
|
352
|
-
### 输出文件已存在
|
|
353
|
-
|
|
354
|
-
默认不会覆盖文件。确认目标可以覆盖后使用:
|
|
355
|
-
|
|
356
|
-
```bash
|
|
357
|
-
md2docx -f report.md --force
|
|
358
|
-
```
|
|
359
|
-
|
|
360
407
|
### 从其他目录转换时图片缺失
|
|
361
408
|
|
|
362
409
|
相对图片路径应以原始 Markdown 文件为基准:
|
package/config/config.json
CHANGED
|
@@ -117,6 +117,31 @@
|
|
|
117
117
|
},
|
|
118
118
|
"required": ["enabled", "theme", "density"]
|
|
119
119
|
},
|
|
120
|
+
"imageSize": {
|
|
121
|
+
"description": "DOCX 图片尺寸限制",
|
|
122
|
+
"type": "object",
|
|
123
|
+
"additionalProperties": false,
|
|
124
|
+
"properties": {
|
|
125
|
+
"enabled": {
|
|
126
|
+
"description": "按图片自然尺寸等比缩小超限图片",
|
|
127
|
+
"type": "boolean",
|
|
128
|
+
"default": true
|
|
129
|
+
},
|
|
130
|
+
"maxWidthCm": {
|
|
131
|
+
"description": "图片最大宽度(厘米)",
|
|
132
|
+
"type": "number",
|
|
133
|
+
"exclusiveMinimum": 0,
|
|
134
|
+
"default": 15.5
|
|
135
|
+
},
|
|
136
|
+
"maxHeightCm": {
|
|
137
|
+
"description": "图片最大高度(厘米)",
|
|
138
|
+
"type": "number",
|
|
139
|
+
"exclusiveMinimum": 0,
|
|
140
|
+
"default": 22
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
"required": ["enabled", "maxWidthCm", "maxHeightCm"]
|
|
144
|
+
},
|
|
120
145
|
"detectTitle": {
|
|
121
146
|
"description": "文档标题",
|
|
122
147
|
"type": "object",
|
|
@@ -162,6 +187,7 @@
|
|
|
162
187
|
"normalizeHeadings",
|
|
163
188
|
"numberHeadings",
|
|
164
189
|
"renderMermaid",
|
|
190
|
+
"imageSize",
|
|
165
191
|
"detectTitle",
|
|
166
192
|
"removeThematicBreaks"
|
|
167
193
|
]
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
local max_width_cm
|
|
2
|
+
local max_height_cm
|
|
3
|
+
local size_cache = {}
|
|
4
|
+
local warned = {}
|
|
5
|
+
|
|
6
|
+
local function warn_once(source, message)
|
|
7
|
+
if warned[source] then
|
|
8
|
+
return
|
|
9
|
+
end
|
|
10
|
+
warned[source] = true
|
|
11
|
+
local text = "无法限制图片尺寸 " .. source .. ":" .. message
|
|
12
|
+
if pandoc.log and pandoc.log.warn then
|
|
13
|
+
pandoc.log.warn(text)
|
|
14
|
+
else
|
|
15
|
+
io.stderr:write("[WARNING] " .. text .. "\n")
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
local function metadata_number(meta, key)
|
|
20
|
+
local value = meta[key]
|
|
21
|
+
if value == nil then
|
|
22
|
+
return nil
|
|
23
|
+
end
|
|
24
|
+
return tonumber(pandoc.utils.stringify(value))
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
local function read_config(meta)
|
|
28
|
+
max_width_cm = metadata_number(meta, "md2docx-image-max-width-cm")
|
|
29
|
+
max_height_cm = metadata_number(meta, "md2docx-image-max-height-cm")
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
local function image_size(source)
|
|
33
|
+
local cached = size_cache[source]
|
|
34
|
+
if cached ~= nil then
|
|
35
|
+
return cached or nil
|
|
36
|
+
end
|
|
37
|
+
if pandoc.image == nil or pandoc.image.size == nil then
|
|
38
|
+
warn_once(source, "当前 Pandoc 不支持 pandoc.image.size,请升级到 3.1.13 或更高版本")
|
|
39
|
+
size_cache[source] = false
|
|
40
|
+
return nil
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
local fetched, _, contents = pcall(pandoc.mediabag.fetch, source)
|
|
44
|
+
if not fetched or contents == nil then
|
|
45
|
+
warn_once(source, fetched and "未读取到图片内容" or tostring(_))
|
|
46
|
+
size_cache[source] = false
|
|
47
|
+
return nil
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
local measured, size = pcall(pandoc.image.size, contents, PANDOC_WRITER_OPTIONS)
|
|
51
|
+
if not measured then
|
|
52
|
+
warn_once(source, tostring(size))
|
|
53
|
+
size_cache[source] = false
|
|
54
|
+
return nil
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
size_cache[source] = size
|
|
58
|
+
return size
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
local function limit_image(image)
|
|
62
|
+
if max_width_cm == nil or max_height_cm == nil then
|
|
63
|
+
return nil
|
|
64
|
+
end
|
|
65
|
+
if image.attributes.width ~= nil or image.attributes.height ~= nil then
|
|
66
|
+
return nil
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
local size = image_size(image.src)
|
|
70
|
+
if size == nil then
|
|
71
|
+
return nil
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
local fallback_dpi = PANDOC_WRITER_OPTIONS.dpi or 96
|
|
75
|
+
local horizontal_dpi = size.dpi_horz > 0 and size.dpi_horz or fallback_dpi
|
|
76
|
+
local vertical_dpi = size.dpi_vert > 0 and size.dpi_vert or fallback_dpi
|
|
77
|
+
local width_cm = size.width / horizontal_dpi * 2.54
|
|
78
|
+
local height_cm = size.height / vertical_dpi * 2.54
|
|
79
|
+
local scale = math.min(1, max_width_cm / width_cm, max_height_cm / height_cm)
|
|
80
|
+
|
|
81
|
+
if scale >= 1 then
|
|
82
|
+
return nil
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
image.attributes.width = string.format("%.4fcm", width_cm * scale)
|
|
86
|
+
image.attributes.height = string.format("%.4fcm", height_cm * scale)
|
|
87
|
+
return image
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
return {
|
|
91
|
+
{ Meta = read_config },
|
|
92
|
+
{ Image = limit_image },
|
|
93
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://raw.githubusercontent.com/WXY-V1hZ/md2docx/main/config/style-config.schema.json",
|
|
3
|
+
"schemaVersion": 1,
|
|
4
|
+
"options": {
|
|
5
|
+
"body": {
|
|
6
|
+
"firstLineIndent": true
|
|
7
|
+
},
|
|
8
|
+
"headings": {
|
|
9
|
+
"1": {
|
|
10
|
+
"startOnNewPage": false
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"inlineCode": {
|
|
14
|
+
"background": true
|
|
15
|
+
},
|
|
16
|
+
"codeBlock": {
|
|
17
|
+
"border": true
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://raw.githubusercontent.com/WXY-V1hZ/md2docx/main/config/style-config.schema.json",
|
|
4
|
+
"title": "md2docx 语义化样式配置",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["schemaVersion"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"$schema": {
|
|
10
|
+
"type": "string"
|
|
11
|
+
},
|
|
12
|
+
"schemaVersion": {
|
|
13
|
+
"const": 1
|
|
14
|
+
},
|
|
15
|
+
"options": {
|
|
16
|
+
"type": "object",
|
|
17
|
+
"additionalProperties": false,
|
|
18
|
+
"properties": {
|
|
19
|
+
"body": {
|
|
20
|
+
"type": "object",
|
|
21
|
+
"additionalProperties": false,
|
|
22
|
+
"properties": {
|
|
23
|
+
"firstLineIndent": {
|
|
24
|
+
"type": "boolean",
|
|
25
|
+
"description": "正文是否使用预设的首行缩进"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"headings": {
|
|
30
|
+
"type": "object",
|
|
31
|
+
"additionalProperties": false,
|
|
32
|
+
"properties": {
|
|
33
|
+
"1": {
|
|
34
|
+
"type": "object",
|
|
35
|
+
"additionalProperties": false,
|
|
36
|
+
"properties": {
|
|
37
|
+
"startOnNewPage": {
|
|
38
|
+
"type": "boolean",
|
|
39
|
+
"description": "一级标题是否另起一页"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"inlineCode": {
|
|
46
|
+
"type": "object",
|
|
47
|
+
"additionalProperties": false,
|
|
48
|
+
"properties": {
|
|
49
|
+
"background": {
|
|
50
|
+
"type": "boolean",
|
|
51
|
+
"description": "行内代码是否使用预设背景"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"codeBlock": {
|
|
56
|
+
"type": "object",
|
|
57
|
+
"additionalProperties": false,
|
|
58
|
+
"properties": {
|
|
59
|
+
"border": {
|
|
60
|
+
"type": "boolean",
|
|
61
|
+
"description": "代码块是否使用预设外框"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -559,7 +559,7 @@
|
|
|
559
559
|
"eastAsia": "zh-CN"
|
|
560
560
|
},
|
|
561
561
|
"shading": {
|
|
562
|
-
"
|
|
562
|
+
"type": "pct5",
|
|
563
563
|
"color": "auto",
|
|
564
564
|
"fill": "auto"
|
|
565
565
|
}
|
|
@@ -571,40 +571,40 @@
|
|
|
571
571
|
},
|
|
572
572
|
"wordWrap": false,
|
|
573
573
|
"shading": {
|
|
574
|
-
"
|
|
574
|
+
"type": "clear",
|
|
575
575
|
"color": "F3F4F4",
|
|
576
576
|
"fill": "FFFFFF",
|
|
577
577
|
"themeFill": "background1"
|
|
578
578
|
},
|
|
579
579
|
"border": {
|
|
580
580
|
"top": {
|
|
581
|
-
"
|
|
581
|
+
"style": "single",
|
|
582
582
|
"color": "BFBFBF",
|
|
583
|
-
"
|
|
583
|
+
"size": 8,
|
|
584
584
|
"space": 10,
|
|
585
585
|
"themeColor": "background1",
|
|
586
586
|
"themeShade": "BF"
|
|
587
587
|
},
|
|
588
588
|
"left": {
|
|
589
|
-
"
|
|
589
|
+
"style": "single",
|
|
590
590
|
"color": "BFBFBF",
|
|
591
|
-
"
|
|
591
|
+
"size": 8,
|
|
592
592
|
"space": 10,
|
|
593
593
|
"themeColor": "background1",
|
|
594
594
|
"themeShade": "BF"
|
|
595
595
|
},
|
|
596
596
|
"bottom": {
|
|
597
|
-
"
|
|
597
|
+
"style": "single",
|
|
598
598
|
"color": "BFBFBF",
|
|
599
|
-
"
|
|
599
|
+
"size": 8,
|
|
600
600
|
"space": 10,
|
|
601
601
|
"themeColor": "background1",
|
|
602
602
|
"themeShade": "BF"
|
|
603
603
|
},
|
|
604
604
|
"right": {
|
|
605
|
-
"
|
|
605
|
+
"style": "single",
|
|
606
606
|
"color": "BFBFBF",
|
|
607
|
-
"
|
|
607
|
+
"size": 8,
|
|
608
608
|
"space": 10,
|
|
609
609
|
"themeColor": "background1",
|
|
610
610
|
"themeShade": "BF"
|
|
@@ -750,7 +750,7 @@
|
|
|
750
750
|
"eastAsia": "zh-CN"
|
|
751
751
|
},
|
|
752
752
|
"shading": {
|
|
753
|
-
"
|
|
753
|
+
"type": "clear",
|
|
754
754
|
"color": "F3F4F4",
|
|
755
755
|
"fill": "FFFFFF",
|
|
756
756
|
"themeFill": "background1"
|
|
@@ -844,16 +844,16 @@
|
|
|
844
844
|
"eastAsia": "zh-CN"
|
|
845
845
|
},
|
|
846
846
|
"shading": {
|
|
847
|
-
"
|
|
847
|
+
"type": "clear",
|
|
848
848
|
"color": "F3F4F4",
|
|
849
849
|
"fill": "F2F2F2",
|
|
850
850
|
"themeFill": "background1",
|
|
851
851
|
"themeFillShade": "F2"
|
|
852
852
|
},
|
|
853
853
|
"border": {
|
|
854
|
-
"
|
|
854
|
+
"style": "none",
|
|
855
855
|
"color": "auto",
|
|
856
|
-
"
|
|
856
|
+
"size": 0,
|
|
857
857
|
"space": 0
|
|
858
858
|
}
|
|
859
859
|
}
|