Skip to content

Commit

Permalink
1.3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
LeafYeeXYZ committed May 28, 2024
1 parent f000bce commit 3943881
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ mdp
#### 1.1.1 三级标题
正文

![图片标题](图片路径)
![](图片路径)

> 图片标题

> 表格标题

Expand All @@ -45,9 +47,12 @@ mdp
- 文献1
- 文献2
- 文献3

##### 附录
```

## 更新日志
- `1.3.2` (2024-05-28): 优化图表标题显示
- `1.3.1` (2024-05-28): 优化样式
- `1.3.0` (2024-05-26): 支持自定义 `CSS` 文件, 简化编写格式, 优化帮助信息
- `1.2.3` (2024-05-25): 修复中文图片路径导致的错误
Expand Down
10 changes: 2 additions & 8 deletions css/APS.css
Original file line number Diff line number Diff line change
Expand Up @@ -93,20 +93,14 @@ ul, ol { /* 参考文献的项目: 小五号宋体 */
}
}

.image-title { /* 图片的标题: 小五号宋体 */
font-size: 12px;
font-weight: normal;
text-align: center;
margin: 6px 0;
}
img {
display: block;
max-width: 100%;
margin: 0 auto;
margin-bottom: 10px;
margin-top: 10px;
}

blockquote, blockquote > p { /* 表格的标题: 小五号宋体 */
blockquote, blockquote > p { /* 图片和表格的标题: 小五号宋体 */
font-size: 12px;
font-weight: normal;
text-align: center;
Expand Down
3 changes: 1 addition & 2 deletions lib/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,8 @@ async function renderMarkdown(options: Options): Promise<void> {
</body>
</html>
`
// 把包裹图片的 p 标签去掉, 并添加标题 <div class="image-title">...</div>
// 把包裹图片的 p 标签去掉
web = web.replace(/<p><img (.*?)><\/p>/g, '<img $1>')
web = web.replace(/<img src="(.*?)" alt="(.*?)">/g, '<div class="image-title">$2</div><img src="$1" alt="$2">')
// 保存 html 文件
options.outputHTML && await fs.writeFile(options.out.replace('.pdf', '.html'), web)
// 把图片转换为 base64
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "leaf-markdown-paper",
"type": "module",
"version": "1.3.1",
"version": "1.3.2",
"author": {
"name": "LeafYeeXYZ",
"email": "[email protected]"
Expand Down

0 comments on commit 3943881

Please sign in to comment.