Skip to content

feat: 优化 PDF 导出并补充调试文档#143

Open
me-o wants to merge 4 commits into
AnyayayPlus:masterfrom
me-o:feature/pdf-export-table
Open

feat: 优化 PDF 导出并补充调试文档#143
me-o wants to merge 4 commits into
AnyayayPlus:masterfrom
me-o:feature/pdf-export-table

Conversation

@me-o

@me-o me-o commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

变更内容

  • 为正文表格添加默认的紧凑打印样式
  • 限制 MathJax 公式宽度
  • 优化多列表格的列宽和单元格间距
  • 新增 scripts/README.md,说明 pdf:singlepdf:all 的调试方式
02 微粒间作用力与物质性质/04 金属键 金属晶体.html

|                | 简单立方堆积                                            | 体心立方堆积                                                                        | 面心立方最密堆积                                                         | 六方最密堆积                                            |
| -------------- | ------------------------------------------------------- | ----------------------------------------------------------------------------------- | ------------------------------------------------------------------------ | :------------------------------------------------------ |
| **原子位置**   | 顶角                                                    | 顶角、体心                                                                          | 顶角、面心                                                               |                                                         |
| **原子数**     | $8 \times \frac{1}{8}=1$                                | $8\times\frac{1}{8}+1=2$                                                            | $8\times\frac{1}{8}+6\times\frac{1}{2}=4$                                | $12\times\frac{1}{6}+2\times\frac{1}{2}+3=6$            |
| **配位数**     | $6$                                                     | $8$                                                                                 | $12$                                                                     | $12$                                                    |
| **空间利用率** | $\dfrac{\dfrac{4}{3}πr^3}{8r^3}\cdot100\%\approx52.4\%$ | $\dfrac{2\cdot \dfrac{4}{3}πr^3}{(\dfrac{4}{\sqrt{3}}r)^3}\cdot100\%\approx68.02\%$ | $\frac{4\cdot \dfrac{4}{3}πr^3}{16\sqrt{2}r^3}\cdot 100\%\approx74.05\%$ | $\frac{8\pi R^3}{24\sqrt2R^3}\times100\%\approx74.05\%$ |
| **代表金属**   | $Po$                                                    | $Na、K、Fe、Li、Ba$                                                                 | $Cu、Ag、Au、Al、Pd、Ca$                                                 | $Mg、Zn、Ti$                                            |

优化前
image

优化后
image

03 分子空间结构与物质性质/01 价层电子对互斥模型.html

|   分子或离子    | 中心原子 |   $a$   | $x$ | $b$ |         孤电子对数          | 价层电子对数 |          说明           | $\text{VSEPR}$ 模型 |
| :-------------: | :------: | :-----: | :-: | :-: | :-------------------------: | ------------ | :---------------------: | :-----------------: |
|   $\ce{SO_2}$   | $\ce{S}$ |   $6$   | $2$ | $2$ | $\frac{1}{2}(6-2\times2)=1$ | $2+1=3$      | $2 \sigma + 1 孤电子对$ |     平面三角形      |
|   $\ce{NH+4}$   | $\ce{N}$ | $5-1=4$ | $4$ | $1$ | $\frac{1}{2}(4-4\times1)=0$ | $4+0=4$      | $4 \sigma + 0 孤电子对$ |     正四面体形      |
| $\ce{CO^{2-}3}$ | $\ce{C}$ | $4+2=6$ | $3$ | $0$ | $\frac{1}{2}(6-3\times2)=1$ | $3+0=3$      | $3 \sigma + 0 孤电子对$ |     平面三角形      |

优化前
image

优化后
image

Related Issue

Refs #138

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

该 PR围绕 Issue #138(PDF 导出时表格/可横向滚动块右侧内容被截断)对现有 export-pdf 导出逻辑做增强:在不改变整体导出流程的前提下,通过注入 PDF 专用 @media print CSS 来改善表格在打印/PDF 场景下的布局,并补充了本地调试说明与新增导出命令,方便复现与迭代样式问题。

Changes:

  • scripts/export-pdf.js 中注入面向 PDF 的打印样式,改善表格换行与溢出问题,并新增 pdf-wrap-table / pdf-wide-table 两种可选处理方式。
  • 新增 scripts/README.md,说明 pdf:singlepdf:all 的用途与调试方法(含字体调试开关)。
  • package.json 中新增 pdf:single / pdf:all 脚本,并在 .gitignore 中加入导出产物与测试列表文件的忽略规则。

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.

File Description
scripts/README.md 新增 PDF 导出调试文档,说明单页/全量导出与字体调试方式
scripts/export-pdf.js 注入 PDF 专用打印 CSS,新增针对长表格的可选样式类支持
package.json 新增 pdf:single / pdf:all 两个导出脚本入口
.gitignore 忽略 PDF 输出目录与 pdf:single 使用的列表文件

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/export-pdf.js Outdated
Comment on lines +212 to +216
width: 117.65% !important;
max-width: none !important;
overflow: visible !important;
transform: scale(0.85);
transform-origin: top left;
Comment thread package.json
@Seeridia

Seeridia commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator

其实我觉得不应该专门添加 <div class="pdf-wide-table"> 来标记,而是这个 css 对所有表格都能适用

@me-o

me-o commented Jun 6, 2026

Copy link
Copy Markdown
Contributor Author

其实我觉得不应该专门添加 <div class="pdf-wide-table"> 来标记,而是这个 css 对所有表格都能适用

优化了一下当前实现,目前可以对部分表格和公式场景做简单适配

  • 为正文表格添加默认的紧凑打印样式
  • 限制 MathJax 公式宽度
  • 优化多列表格的列宽和单元格间距

目前能覆盖大部分场景,但感觉应该还有更优雅的方案

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 4 changed files in this pull request and generated 4 comments.

Comment thread scripts/export-pdf.js
Comment thread scripts/export-pdf.js
Comment thread scripts/export-pdf.js
Comment thread scripts/export-pdf.js
@me-o me-o force-pushed the feature/pdf-export-table branch from 5b13407 to ff24837 Compare June 8, 2026 03:40
@me-o me-o force-pushed the feature/pdf-export-table branch from ff24837 to 2a114d7 Compare June 10, 2026 05:08
@me-o me-o force-pushed the feature/pdf-export-table branch from 2a114d7 to 4b6e257 Compare June 10, 2026 05:13
@Seeridia Seeridia marked this pull request as draft June 10, 2026 05:24
@Seeridia

Copy link
Copy Markdown
Collaborator

@me-o 你看看你这边准备好了没有,如果没问题了就 @ 我再转 Ready for review

@me-o

me-o commented Jun 10, 2026

Copy link
Copy Markdown
Contributor Author

@me-o 你看看你这边准备好了没有,如果没问题了就 @ 我再转 Ready for review

没有修改,只是看到主分支好像更新了就合了一下,然后copilot好像还是根据第一次的pr内容做review @Seeridia

@Seeridia Seeridia requested a review from Copilot June 13, 2026 13:20
@Seeridia Seeridia marked this pull request as ready for review June 13, 2026 13:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

Comment thread scripts/README.md
Comment on lines +5 to +8
```json
"pdf:single": "bun scripts/export-pdf.js --list scripts/pdf-repo-test.txt --out-dir pdf-repo-single --concurrency 1",
"pdf:all": "bun scripts/export-pdf.js --out-dir pdf-repo --concurrency 4"
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants