Skip to content

kawamt/rehype-probe-image-size

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

main

rehype-probe-image-size

Rehype plugin to set the size of img elements.

For remote images, a small amount of data is downloaded internally to get the size.

Syntax

## remote image
![](https://cdn.example.com/sample.png)

## local image
![](/sample.png)

Example

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);

Dependencies

probe-image-size get image size without full download.

No need to download the entire image to get the dimensions.

About

Rehype plugin to set the size of img elements.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published