@mdit/plugin-img-size
支持设置图片尺寸的插件。
使用
TS
import MarkdownIt from "markdown-it";
import { imgSize } from "@mdit/plugin-img-size";
const mdIt = MarkdownIt().use(imgSize);
mdIt.render("");
JS
const MarkdownIt = require("markdown-it");
const { imgSize } = require("@mdit/plugin-img-size");
const mdIt = MarkdownIt().use(imgSize);
mdIt.render("");
语法
你可以在图片链接末尾使用 =widthxheight
来指定图片尺寸。
width
和 height
都应该为数字并意味着像素单位的尺寸,并且它们两者都是可选的。整个标记应该通过空格与图片链接相分割。



会被解析为
<img src="/example.png" width="200" height="300" />
<img src="/example.jpg" title="Image title" width="200" />
<img src="/example.bmp" height="300" />
示例
示例


