Skip to content

Commit c16cf1a

Browse files
committed
feat: Add support for percentage-based image dimensions and update web app dependencies.
1 parent 86369c2 commit c16cf1a

File tree

7 files changed

+17
-11
lines changed

7 files changed

+17
-11
lines changed

README-zh.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,10 +209,11 @@ const imageAdapter: (token: Tokens.Image) => Promise<null | MarkdownImageItem>
209209
210210
### 自定义图片尺寸
211211
212-
您可以在 Markdown 图片的 title 属性中指定自定义尺寸,格式为 `宽度x高度`(例如 `600x400`)。这将覆盖图片的原始尺寸,在生成的 DOCX 文档中使用自定义尺寸渲染图片。这对于控制图片大小和避免超出 Word 的最大宽度限制非常有用。
212+
您可以在 Markdown 图片的 title 属性中指定自定义尺寸,格式为 `宽度x高度`(例如 `600x400`, `30%x30%`)。这将覆盖图片的原始尺寸,在生成的 DOCX 文档中使用自定义尺寸渲染图片。这对于控制图片大小和避免超出 Word 的最大宽度限制非常有用。
213213
214214
```markdown
215215
![Alt text](image.png "600x400")
216+
![Alt text](image.png "30%x30%")
216217
```
217218

218219
自定义尺寸将应用于生成的 DOCX 文件中的图片,而原始图片数据保持不变。

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,10 +318,11 @@ const imageAdapter: (token: Tokens.Image) => Promise<null | MarkdownImageItem>
318318
319319
### Custom Image Size
320320
321-
You can specify custom image dimensions in the Markdown image title attribute using the format `widthxheight` (e.g., `600x400`). This will override the original image dimensions when rendering in the DOCX document, which is useful for controlling image size and avoiding Word's maximum width constraints.
321+
You can specify custom image dimensions in the Markdown image title attribute using the format `widthxheight` (e.g., `600x400` or `30%x30%`). This will override the original image dimensions when rendering in the DOCX document, which is useful for controlling image size and avoiding Word's maximum width constraints.
322322
323323
```markdown
324324
![Alt text](image.png "600x400")
325+
![Alt text](image.png "30%x30%")
325326
```
326327

327328
The custom dimensions will be applied to the image in the generated DOCX file, while the original image data remains unchanged.

web/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "web",
33
"private": true,
4-
"version": "0.0.0",
4+
"version": "0.0.1",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",
@@ -17,6 +17,6 @@
1717
},
1818
"dependencies": {
1919
"clsx": "^2.1.1",
20-
"markdown-docx": "^1.5.0"
20+
"markdown-docx": "^1.5.1"
2121
}
2222
}

web/pnpm-lock.yaml

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web/public/pull-shark.png

71.8 KB
Loading

web/public/starstruck.png

69.8 KB
Loading

web/src/template.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,14 @@ Welcome to the Markdown to DOCX converter! This tool allows you to:
3434
- [ ] this is an incomplete item
3535

3636
## Images
37+
Images are fully supported, including specifying dimensions (e.g., `64x64`), scaling percentages (e.g., `30%x30%`), and WebP format.
3738

38-
Here's our logo (hover to see the title text):
39+
Here are some examples:
40+
41+
![alt text](pull-shark.png "64x64")
42+
43+
![alt text](starstruck.png "30%x30%")
3944

40-
![alt text](https://img.alicdn.com/imgextra/i3/O1CN012ZjB2y1xHUf6OzZ8C_!!6000000006418-2-tps-104-126.png "Logo Title Text 1")
4145
![webp Support](./webp.webp "Logo Title Text 1")
4246

4347

0 commit comments

Comments
 (0)