rehype-probe-image-size
Version:
Rehype plugin to set the size of img elements.
43 lines (29 loc) • 991 B
Markdown

Rehype plugin to set the size of img elements.
For remote images, a small amount of data is downloaded internally to get the size.
```markdown


```
```javascript
import unified from "unified";
import remarkParse from "remark-parse";
import remarkRehype from "remark-rehype";
import rehypeStringify from "rehype-stringify";
import rehypeProbeImageSize from "rehype-probe-image-size";
unified()
.use(remarkParse)
.use(remarkRehype)
.use(rehypeProbeImageSize, { staticDir: "public" })
.use(rehypeStringify)
.process(markdown);
```
probe-image-size get image size without full download.
No need to download the entire image to get the dimensions.