bit-ppt-generator 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.
@@ -0,0 +1,661 @@
1
+ # AI Content Guide
2
+
3
+ Use this guide when asking an AI model to create a BIT-style PPT deck. The
4
+ model should produce YAML only. It should not write PowerPoint code.
5
+
6
+ ## Required Shape
7
+
8
+ ```yaml
9
+ meta:
10
+ title: Presentation title
11
+ subtitle: Optional subtitle
12
+ author: Author or team
13
+ advisor: Organization or advisor
14
+ date: 2026.05
15
+ fonts:
16
+ cn: 微软雅黑
17
+ en: Arial
18
+ serif: SimSun
19
+ code: Consolas
20
+
21
+ slides:
22
+ - layout: title
23
+ - layout: agenda
24
+ title: 目录
25
+ items: [Section 1, Section 2, Section 3]
26
+ ```
27
+
28
+ `meta.fonts` is optional. On Windows, `微软雅黑` is the default Chinese font.
29
+ For cross-platform decks, use a commonly installed CJK font such as
30
+ `Noto Sans CJK SC` or `Source Han Sans SC`, or pass `--font-cn` in the CLI.
31
+
32
+ ## Speaker Notes
33
+
34
+ Every slide may include `speakerNotes` for the PowerPoint/WPS notes pane. These
35
+ notes are not rendered on the slide canvas.
36
+
37
+ ```yaml
38
+ - layout: bullets
39
+ title: 核心观点
40
+ bullets:
41
+ - 输出是可编辑 PPTX。
42
+ speakerNotes: |
43
+ 这一页先解释为什么选择 YAML 到 PPTX 的路线。
44
+ Formula text is kept as plain text in notes for now: $L(\theta)$.
45
+ ```
46
+
47
+ Use a block string for paragraph-style scripts, or a short string list when the
48
+ script is naturally segmented. Keep notes concise; very long scripts are
49
+ reported as validation warnings.
50
+
51
+ ## Image Placeholders
52
+
53
+ When the user has no image yet or cannot upload images, do not invent local
54
+ paths. Use an editable placeholder with a concrete image prompt.
55
+
56
+ ```yaml
57
+ - layout: imageText
58
+ title: 系统架构示意
59
+ image:
60
+ mode: placeholder
61
+ aspectRatio: "16:9"
62
+ placement: top
63
+ prompt: 展示 YAML 输入、结构校验、PPTX 生成、OMML 后处理的流程图。
64
+ text:
65
+ - 用户后续可在 WPS / PowerPoint 中替换占位框。
66
+ ```
67
+
68
+ If `imageText.image.aspectRatio` is omitted, `auto`, or `unknown`, preflight
69
+ creates two candidate slides: a top-image layout and a side-image layout. This
70
+ lets the user keep whichever page fits the eventual image. Placeholder images
71
+ are supported by `imageText`, `caseStudy`, and `imageGrid`.
72
+
73
+ ## Supported Layouts
74
+
75
+ - `title`
76
+ - `agenda`
77
+ - `section`
78
+ - `bullets`
79
+ - `claim`
80
+ - `twoColumn`
81
+ - `cards`
82
+ - `table`
83
+ - `comparison`
84
+ - `timeline`
85
+ - `process`
86
+ - `architecture`
87
+ - `ablation`
88
+ - `caseStudy`
89
+ - `imageGrid`
90
+ - `code`
91
+ - `appendix`
92
+ - `flowchart`
93
+ - `chart`
94
+ - `problemSolution`
95
+ - `painOpportunity`
96
+ - `experimentDesign`
97
+ - `resultAnalysis`
98
+ - `riskMitigation`
99
+ - `contribution`
100
+ - `summary`
101
+ - `metrics`
102
+ - `matrix`
103
+ - `quote`
104
+ - `formula`
105
+ - `references`
106
+ - `imageText`
107
+ - `closing`
108
+
109
+ ## Layout Schemas
110
+
111
+ ### `title`
112
+
113
+ Uses `meta` only.
114
+
115
+ ```yaml
116
+ - layout: title
117
+ ```
118
+
119
+ ### `agenda`
120
+
121
+ ```yaml
122
+ - layout: agenda
123
+ title: 目录
124
+ items:
125
+ - 研究背景
126
+ - 方法设计
127
+ - 实验结果
128
+ ```
129
+
130
+ ### `section`
131
+
132
+ ```yaml
133
+ - layout: section
134
+ sectionNo: "01"
135
+ title: 研究背景
136
+ subtitle: 一句话说明本章节关注点
137
+ ```
138
+
139
+ ### `bullets`
140
+
141
+ Use for several peer-level findings. Keep bullets concise. A good bullet is
142
+ usually under 32 Chinese characters. The generator can split long bullet lists.
143
+
144
+ ```yaml
145
+ - layout: bullets
146
+ title: 核心发现
147
+ lead: 一句话概括本页结论。
148
+ bullets:
149
+ - 第一个要点。
150
+ - 第二个要点。
151
+ - 第三个要点。
152
+ ```
153
+
154
+ ### `claim`
155
+
156
+ Use when the slide should make one strong conclusion and list supporting
157
+ evidence. Prefer one sentence in `claim`.
158
+
159
+ ```yaml
160
+ - layout: claim
161
+ title: 单页核心结论
162
+ claim: 让模型生成结构化内容,让模板负责排版。
163
+ evidence:
164
+ - 证据一。
165
+ - 证据二。
166
+ ```
167
+
168
+ ### `twoColumn`
169
+
170
+ Use for contrast, pros/cons, old/new, before/after, or two parallel arguments.
171
+
172
+ ```yaml
173
+ - layout: twoColumn
174
+ title: 两栏观点页
175
+ left:
176
+ title: 传统做法
177
+ bullets:
178
+ - 问题一。
179
+ - 问题二。
180
+ right:
181
+ title: 推荐做法
182
+ bullets:
183
+ - 优势一。
184
+ - 优势二。
185
+ ```
186
+
187
+ ### `cards`
188
+
189
+ Use for 3 to 6 independent ideas. Keep each card text short.
190
+
191
+ ```yaml
192
+ - layout: cards
193
+ title: 多观点卡片
194
+ cards:
195
+ - title: 观点一
196
+ text: 一句话解释。
197
+ - title: 观点二
198
+ text: 一句话解释。
199
+ ```
200
+
201
+ ### `table`
202
+
203
+ Use no more than 5 columns. Long tables are automatically split by rows.
204
+
205
+ ```yaml
206
+ - layout: table
207
+ title: 对比表
208
+ columns: [维度, 方案 A, 方案 B]
209
+ rows:
210
+ - [成本, 低, 中]
211
+ - [风险, 中, 低]
212
+ ```
213
+
214
+ ### `comparison`
215
+
216
+ ```yaml
217
+ - layout: comparison
218
+ title: 方案对比
219
+ left:
220
+ label: 方案 A
221
+ title: 传统路线
222
+ bullets:
223
+ - 优点或问题。
224
+ right:
225
+ label: 方案 B
226
+ title: 推荐路线
227
+ bullets:
228
+ - 优点或问题。
229
+ ```
230
+
231
+ ### `timeline`
232
+
233
+ Use for roadmap, schedule, milestones, or historical development. Keep to 6
234
+ items or fewer.
235
+
236
+ ```yaml
237
+ - layout: timeline
238
+ title: 路线图
239
+ items:
240
+ - date: 阶段 1
241
+ title: 复刻模板
242
+ text: 固化视觉规范。
243
+ ```
244
+
245
+ ### `process`
246
+
247
+ Use for a linear workflow. Keep to 5 steps or fewer.
248
+
249
+ ```yaml
250
+ - layout: process
251
+ title: 工作流程
252
+ steps:
253
+ - title: 规划
254
+ text: 选择页面类型。
255
+ - title: 生成
256
+ text: 输出 YAML。
257
+ ```
258
+
259
+ ### `architecture`
260
+
261
+ Use for method architecture, system architecture, model pipeline, or module
262
+ stack. Keep to 4 layers, each with no more than 5 components.
263
+
264
+ ```yaml
265
+ - layout: architecture
266
+ title: 方法架构
267
+ layers:
268
+ - title: 输入层
269
+ components: [文本, 图像, 表格]
270
+ note: 对输入进行结构化编码。
271
+ - title: 模型层
272
+ components: [Encoder, Fusion, Decoder]
273
+ note: 支持 $p_{\theta}(x_i)$ 等行内公式。
274
+ ```
275
+
276
+ ### `ablation`
277
+
278
+ Use for ablation studies. Prefer short entries because the layout is table-like.
279
+
280
+ ```yaml
281
+ - layout: ablation
282
+ title: 消融实验
283
+ baseline: 完整模型作为对照。
284
+ items:
285
+ - factor: 模块 A
286
+ setting: 移除该模块
287
+ delta: "-2.3%"
288
+ conclusion: 性能下降,说明该模块有效。
289
+ ```
290
+
291
+ ### `caseStudy`
292
+
293
+ Use for one example, one sample, one qualitative analysis, or one system usage
294
+ case. Image paths are relative to this package directory.
295
+
296
+ ```yaml
297
+ - layout: caseStudy
298
+ title: 案例分析
299
+ image: assets/bit-campus-photo.png
300
+ caption: 案例图片说明。
301
+ context:
302
+ - 案例背景。
303
+ method:
304
+ - 处理方法。
305
+ result:
306
+ - 观察结果。
307
+ ```
308
+
309
+ ### `imageGrid`
310
+
311
+ Use for qualitative results, visual comparisons, or multiple screenshots. Keep
312
+ to 6 images or fewer.
313
+
314
+ ```yaml
315
+ - layout: imageGrid
316
+ title: 多图结果
317
+ images:
318
+ - path: assets/bit-campus-photo.png
319
+ caption: 输入
320
+ - path: assets/bit-campus-photo.png
321
+ caption: 输出
322
+ ```
323
+
324
+ ### `code`
325
+
326
+ Use for pseudocode, algorithm steps, or a compact code fragment. Keep code under
327
+ about 12 short lines.
328
+
329
+ ```yaml
330
+ - layout: code
331
+ title: 算法伪代码
332
+ language: Algorithm
333
+ code: |
334
+ Input: data D
335
+ 1. encode D
336
+ 2. optimize objective L(theta)
337
+ notes:
338
+ - 说明关键约束。
339
+ ```
340
+
341
+ ### `appendix`
342
+
343
+ Use for backup material indexes or appendix navigation. Keep to 8 items or
344
+ fewer.
345
+
346
+ ```yaml
347
+ - layout: appendix
348
+ title: 附录索引
349
+ items:
350
+ - key: A1
351
+ title: 数据集细节
352
+ text: 样本来源和统计信息。
353
+ ```
354
+
355
+ ### `flowchart`
356
+
357
+ Use for method flows, data pipelines, system workflows, or dependency diagrams.
358
+ The generator draws native PowerPoint shapes and arrow lines, so the result
359
+ remains editable. Keep to 10 nodes or fewer.
360
+
361
+ If `edges` is omitted, nodes are connected in order. Custom `x` and `y` are
362
+ allowed and are relative to the internal chart area, but most AI-generated decks
363
+ should rely on the automatic layout.
364
+
365
+ ```yaml
366
+ - layout: flowchart
367
+ title: 方法流程图
368
+ nodes:
369
+ - id: input
370
+ text: 输入数据
371
+ note: 文本 / 图像 / 表格
372
+ - id: encode
373
+ text: 编码器
374
+ note: 得到 $h_i$
375
+ - id: output
376
+ text: 预测输出
377
+ emphasis: true
378
+ edges:
379
+ - from: input
380
+ to: encode
381
+ - from: encode
382
+ to: output
383
+ note: 流程图使用 PPT 原生形状和箭头。
384
+ ```
385
+
386
+ ### `chart`
387
+
388
+ Use for editable statistical charts. Supported `type` values are `bar`, `line`,
389
+ `pie`, `doughnut`, `scatter`, and `area`; `bar` and `line` are the safest for
390
+ academic reports. Chart labels do not support OMML formulas, so keep math in the
391
+ caption or nearby text instead.
392
+
393
+ ```yaml
394
+ - layout: chart
395
+ title: 实验结果对比
396
+ type: bar
397
+ categories: [Dataset A, Dataset B, Dataset C]
398
+ valueAxisTitle: Accuracy
399
+ series:
400
+ - name: Baseline
401
+ values: [81.2, 83.5, 84.1]
402
+ - name: Ours
403
+ values: [85.6, 87.2, 88.0]
404
+ caption: 原生 PowerPoint 图表,可继续编辑数据。
405
+ ```
406
+
407
+ ### Semantic Research Layouts
408
+
409
+ Use these when the slide has a clear academic role and you want the model to
410
+ write into tighter fields instead of a generic bullet page.
411
+
412
+ ```yaml
413
+ - layout: problemSolution
414
+ title: 问题与方案
415
+ problem:
416
+ title: 现有问题
417
+ bullets: [问题一, 问题二]
418
+ solution:
419
+ title: 本文方案
420
+ bullets: [方法一, 方法二]
421
+ impact:
422
+ title: 预期收益
423
+ bullets: [收益一, 收益二]
424
+
425
+ - layout: painOpportunity
426
+ title: 现状痛点与机会
427
+ status:
428
+ title: 现状
429
+ bullets: [背景一, 背景二]
430
+ pain:
431
+ title: 痛点
432
+ bullets: [痛点一, 痛点二]
433
+ opportunity:
434
+ title: 机会
435
+ bullets: [机会一, 机会二]
436
+
437
+ - layout: experimentDesign
438
+ title: 实验设计
439
+ dataset: [数据集 A, 数据集 B]
440
+ variables: [变量一, 变量二]
441
+ metrics: [Accuracy, F1]
442
+ baselines: [Baseline A, Baseline B]
443
+ procedure: [训练, 验证, 测试]
444
+
445
+ - layout: resultAnalysis
446
+ title: 结果分析
447
+ finding: 本文方法在关键指标上取得稳定提升。
448
+ metrics:
449
+ - value: "+3.2%"
450
+ label: F1
451
+ note: 相比 baseline
452
+ analysis:
453
+ - 提升主要来自结构化规划模块。
454
+
455
+ - layout: riskMitigation
456
+ title: 风险与对策
457
+ items:
458
+ - risk: 公式转换失败
459
+ impact: 影响生成
460
+ mitigation: 回传修复提示并保留原始 LaTeX。
461
+
462
+ - layout: contribution
463
+ title: 主要贡献
464
+ items:
465
+ - title: 贡献一
466
+ text: 简短描述。
467
+
468
+ - layout: summary
469
+ title: 章节小结
470
+ takeaway: 一句话总结本章。
471
+ points:
472
+ - 支撑要点一。
473
+ ```
474
+
475
+ ### `metrics`
476
+
477
+ Use for dashboard-like key numbers. Keep to 4 metrics or fewer.
478
+
479
+ ```yaml
480
+ - layout: metrics
481
+ title: 关键指标
482
+ metrics:
483
+ - value: 12+
484
+ label: 正文版式
485
+ note: 覆盖常见汇报场景
486
+ ```
487
+
488
+ ### `matrix`
489
+
490
+ Use for 2x2 analysis. Provide exactly 4 cells when possible.
491
+
492
+ ```yaml
493
+ - layout: matrix
494
+ title: 方案判断矩阵
495
+ cells:
496
+ - title: 低成本 / 低控制
497
+ text: 简要说明。
498
+ - title: 高成本 / 低控制
499
+ text: 简要说明。
500
+ - title: 低成本 / 高控制
501
+ text: 简要说明。
502
+ - title: 高成本 / 高控制
503
+ text: 简要说明。
504
+ ```
505
+
506
+ ### `quote`
507
+
508
+ Use for a concise quote, principle, or memorable thesis.
509
+
510
+ ```yaml
511
+ - layout: quote
512
+ title: 引用页
513
+ quote: 让模型生成结构化内容,让模板承担视觉和排版责任。
514
+ source: BIT PPT Template Generator
515
+ ```
516
+
517
+ ### `formula`
518
+
519
+ Use for one display formula plus short explanation bullets. The formula is
520
+ converted to Office Math / OMML and written into the PPTX OpenXML. Use `$...$`
521
+ inside explanation text for small inline formulas.
522
+
523
+ Prefer wrapping subscript and superscript bodies in braces: write `p_{\theta}`
524
+ and `x^{(i)}`. The generator has a small tolerance pass that rewrites common
525
+ forms such as `p_\theta`, `x_i`, and `x^2`, but explicit braces are still safer.
526
+
527
+ ```yaml
528
+ - layout: formula
529
+ title: 目标函数
530
+ formula:
531
+ latex: "\\mathcal{L}(\\theta) = -\\sum_i y_i \\log p_{\\theta}(x_i)"
532
+ caption: 交叉熵损失函数
533
+ explanation:
534
+ - "$\\theta$ 表示模型参数。"
535
+ - "$p_{\\theta}(x_i)$ 表示预测概率。"
536
+ ```
537
+
538
+ ### `references`
539
+
540
+ Use for reference lists. Long lists are automatically split into multiple
541
+ slides. Quote strings containing a colon to avoid YAML parsing them as objects.
542
+
543
+ ```yaml
544
+ - layout: references
545
+ title: 参考文献
546
+ items:
547
+ - "Author. Title: subtitle. Publisher, 2026."
548
+ ```
549
+
550
+ ### `imageText`
551
+
552
+ Image paths are relative to this package directory.
553
+ Very wide images are placed above the text by default. Ordinary landscape,
554
+ portrait, and square images stay in a side-by-side composition so the text
555
+ area remains usable. Use `placement` and `fit` when the automatic choice needs
556
+ to be overridden.
557
+
558
+ ```yaml
559
+ - layout: imageText
560
+ title: 图文说明
561
+ image:
562
+ path: assets/bit-campus-photo.png
563
+ placement: auto # auto | top | side
564
+ fit: contain # contain | cover
565
+ text:
566
+ - 说明一。
567
+ - 说明二。
568
+ ```
569
+
570
+ ### `closing`
571
+
572
+ ```yaml
573
+ - layout: closing
574
+ title: 谢谢
575
+ subtitle: 敬请各位老师批评指正
576
+ ```
577
+
578
+ ## Writing Rules
579
+
580
+ - Prefer one clear claim per slide.
581
+ - Do not put paragraph-length text into bullet slides.
582
+ - Use `claim` for a decisive conclusion and `bullets` for peer-level findings.
583
+ - Use `twoColumn` for contrast, `cards` for independent ideas, and `process`
584
+ for ordered steps.
585
+ - Use `architecture` for system/module structure, `ablation` for ablation
586
+ results, `caseStudy` for a single example, and `imageGrid` for qualitative
587
+ comparisons.
588
+ - Use `flowchart` for editable process diagrams and `chart` for editable
589
+ statistical charts.
590
+ - Split wide tables by columns manually; the generator only splits rows.
591
+ - Use `section` slides to separate major parts.
592
+ - Do not invent unsupported chart layouts; use `chart`, `table`, `metrics`, or
593
+ `comparison` instead.
594
+ - Use `formula` for display equations. Keep one major equation per slide.
595
+
596
+ ## Built-In Overflow Handling
597
+
598
+ The generator validates structure and estimates text wrapping before writing the
599
+ PPTX. Run:
600
+
601
+ ```powershell
602
+ node src/generate.mjs input.yaml output.pptx --check
603
+ ```
604
+
605
+ The check output includes `validation.errors`, `validation.warnings`, and
606
+ `repairPrompt`. Errors stop generation; warnings mean the deck can generate but
607
+ should be rewritten for a more stable layout.
608
+
609
+ Typical repair prompts look like:
610
+
611
+ ```text
612
+ Slide 2 flowchart.nodes[3].text: Shorten flowchart.nodes[3].text to 12 characters or split the slide.
613
+ Slide 4 chart.series[0].values: Make every chart series have the same number of values as categories.
614
+ ```
615
+
616
+ - `bullets`: long lists can be split into continuation slides.
617
+ - `table`: long tables can be split by row.
618
+ - `references`: long reference lists can be split into continuation slides.
619
+
620
+ The estimator is conservative because PowerPoint's final font rendering depends
621
+ on the local machine. Keep AI-generated text concise even when auto-splitting is
622
+ available.
623
+
624
+ ## Inline Math
625
+
626
+ Inline `$...$` and `\(...\)` math is supported in normal text boxes for:
627
+
628
+ - `bullets.lead`
629
+ - `bullets[]`
630
+ - `claim.claim`
631
+ - `claim.evidence[]`
632
+ - `twoColumn.left/right.text`
633
+ - `twoColumn.left/right.bullets[]`
634
+ - `cards[].text`
635
+ - `comparison.left/right.bullets[]`
636
+ - `timeline.items[].text`
637
+ - `process.steps[].text`
638
+ - `architecture.layers[].components[]`
639
+ - `architecture.layers[].note`
640
+ - `ablation.baseline`
641
+ - `ablation.items[]`
642
+ - `caseStudy.context[]`
643
+ - `caseStudy.method[]`
644
+ - `caseStudy.result[]`
645
+ - `caseStudy.caption`
646
+ - `imageGrid.images[].caption`
647
+ - `code.notes[]`
648
+ - `appendix.items[].text`
649
+ - `flowchart.nodes[].text`
650
+ - `flowchart.nodes[].note`
651
+ - `flowchart.note`
652
+ - semantic research layouts such as `experimentDesign`, `resultAnalysis`,
653
+ `riskMitigation`, `contribution`, and `summary`
654
+ - `metrics[].note`
655
+ - `matrix.cells[].text`
656
+ - `quote.quote`
657
+ - `imageText.text[]`
658
+ - `formula.explanation[]`
659
+ - `table.columns[]` and `table.rows[][]` are experimentally supported.
660
+
661
+ References currently treat math syntax as plain text.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.