{"_id":"rehype-img-size","_rev":"4-021b94accf31f65028189b2a0916156b","name":"rehype-img-size","dist-tags":{"latest":"1.0.1"},"versions":{"0.0.1":{"name":"rehype-img-size","version":"0.0.1","description":"rehype plugin to set local image size properties to img tag","license":"MIT","keywords":["rehype","rehype-plugin","image","size","html"],"repository":{"type":"git","url":"git+https://github.com/ksoichiro/rehype-img-size.git"},"bugs":{"url":"https://github.com/ksoichiro/rehype-img-size/issues"},"author":{"name":"Soichiro Kashima","email":"soichiro.kashima@gmail.com","url":"https://github.com/ksoichiro"},"devDependencies":{"jest":"^26.6.3","rehype-stringify":"^8.0.0","remark-parse":"^9.0.0","remark-rehype":"^8.0.0","to-vfile":"^6.1.0","unified":"^9.2.1","vfile-reporter":"^6.0.2"},"dependencies":{"image-size":"^0.9.7","unist-util-visit":"^2.0.3"},"scripts":{"test":"jest --coverage"},"gitHead":"dd4ade936530271b3f1150109a2ca614d776d341","homepage":"https://github.com/ksoichiro/rehype-img-size#readme","_id":"rehype-img-size@0.0.1","_nodeVersion":"14.15.4","_npmVersion":"7.6.1","dist":{"integrity":"sha512-AfJgsG0LM81+ozLkdySg5vM93gcw8N9hF8LTs2mKG39pC+wVdId9chelh/oY9MCbqvR8x7jUol4UekgVnPi1rg==","shasum":"bfdb653c08817171ce78ae37db2bee930533cad9","tarball":"https://registry.npmjs.org/rehype-img-size/-/rehype-img-size-0.0.1.tgz","fileCount":4,"unpackedSize":4359,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgVY6nCRA9TVsSAnZWagAAv4sP/2vqBCQ4XfbHJ10xiq4H\nSvhuzVGeMqW44XVyR353+/vU6d7675XK+ICq6IUeR5gYhXZG8D8NnwCxnwKW\nKqZlmXmi6ia53TOMtOle3eJNgl9zTUbadPV/t6BPxSt/NTOVTvwpp7yAlwGC\nTXc6VBVmh2uKyr9llda54nx1ffcuLYhX2A4W1s3E9TvNvK3mFXddpnL68/iD\n4J/x7TKEQ44rjuWCVXdG96aAbBPVVOAg7cp4YGI2eYBZ3/aQsaV+90wpHg/8\nLj2ME/uT9AVu9RmgnRCA0mKs2TtpBkZg39UHhewCan6zKb4bBAAju/HGZSaP\nTdsPWzDtUvvnt2Q+i2Mv7HZDwQ9IB87WwHhCPUL7ClKgJxaj6VVvX5vZc5cc\nHH/vLHX70q2qDGs8iBuGQopS4ozZi03Y1VO/a2zU5vAp78tcLo/RMxU/BWPM\nK2rHVQuXJVSwrpT5M/+8NSbDNRKMTSPSlLLI4CVLjlzkTlBrfjfkb9pF4hC2\nxUwQ5gx2J43w4je32+XY6ZTlBPX5S3MG+UHhXUp3+ZyN951kLaZz61Zry1Te\nOvbkHAx6zTO1eMxEqsqqvoXVm7K6CK+6LOtX/8MfVqDNrYUKkOYw2Syv6j7/\nvKjim8pqAD/SpArEGDLJIz7ru4vGUoIhML8g7COqz2lBXPonyX7ukWiDqgxw\ncE+9\r\n=bGR9\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC0BkcpB2ClZrFHGTDytnKaSoiDLPdNp3eZX3ujX9KShwIhAIcZtNzLsycZzkUXjj/b26mXkLcJQg0KB5OulS5MMqJ1"}]},"_npmUser":{"name":"ksoichiro","email":"soichiro.kashima@gmail.com"},"directories":{},"maintainers":[{"name":"ksoichiro","email":"soichiro.kashima@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rehype-img-size_0.0.1_1616219814545_0.5078505840700578"},"_hasShrinkwrap":false},"0.0.2":{"name":"rehype-img-size","version":"0.0.2","description":"rehype plugin to set local image size properties to img tag","license":"MIT","keywords":["rehype","rehype-plugin","image","size","html"],"repository":{"type":"git","url":"git+https://github.com/ksoichiro/rehype-img-size.git"},"bugs":{"url":"https://github.com/ksoichiro/rehype-img-size/issues"},"author":{"name":"Soichiro Kashima","email":"soichiro.kashima@gmail.com","url":"https://github.com/ksoichiro"},"devDependencies":{"jest":"^26.6.3","rehype-stringify":"^8.0.0","remark-parse":"^9.0.0","remark-rehype":"^8.0.0","to-vfile":"^6.1.0","unified":"^9.2.1","vfile-reporter":"^6.0.2"},"dependencies":{"image-size":"^0.9.7","unist-util-visit":"^2.0.3"},"scripts":{"test":"jest --coverage"},"gitHead":"d815017258581f97244574563bed3b1935ecc99a","homepage":"https://github.com/ksoichiro/rehype-img-size#readme","_id":"rehype-img-size@0.0.2","_nodeVersion":"14.17.5","_npmVersion":"6.14.14","dist":{"integrity":"sha512-pKUz7y8LPqxSrEa1neWe258k1lfBXcj4/p0vXZ4DNndqI8Q63lxQBKeYXsD0mi0uT/YfwD1T9n5UI8mBPm1DWQ==","shasum":"75e8add77c37036435822a57054e4e23a6bb3edb","tarball":"https://registry.npmjs.org/rehype-img-size/-/rehype-img-size-0.0.2.tgz","fileCount":4,"unpackedSize":5161,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh6gs6CRA9TVsSAnZWagAAjhwQAJGCa4zENLEZbcG7pF2F\nwPL/ZUKx3xB6vg4xFgWrqJ7TE1Buka5eXOwv95S4rucgVFAKPxS78V+3U4e5\n3sbP3cT1Q+OhOIiDu1svuiaOF237LR/pT6zD0zEZyn/6LBcWWVhJ9usPFNdS\ny57RI5zzB3Zq74LFfYlMD8kB8Ivec1KLtzNhecITh1rh0PYSvKSCBSnN42yh\n7/Q+BLDo4ak18PluFaX2ecZv7QkVCHppVxDw+9pI0dcJv1tS9rQF+6iLYf2q\nboeOtfoxFE/eCh3iWOENj/1tTVigxTg++ifYLh/zJTHqM5owl2Li4/eOk2+X\niP9A2vthODidT/rqqSru7OpSGAWhslBA3WI6clzah3RRTd5Xd4Xj9sl6CT9i\nYV3iGwE9bMyqfnmqOlOhBTAMYfT+I2d3LsOxETwREmDC19X9A3TwkUmJ/1BW\nBJSVyIvm+hLqogaU6UPtfYC9TS5M5JDDh2WOIUjgy/rrI6d7J73AaI2K+OpV\num4xAcmkFmCf3KMrQUHjho83dXHa4Zw/lybWtLbP02sv15pID3aIy/eaIwpd\nDhT0ywqtl7Hw0PwoQjwNiKYymyvaTPBUo+igF+TL2M1ekxPW/hxY20IMaI6l\n+nuu6ODLpb+O6a3aQbxUVyJn+hhkz00F/eEF0cS5HkBUp9WjhdAzxCDS+SvZ\nv1y3\r\n=iEHy\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD5Lhld0rfvNxqYlwRMbe3P48jYYd6SELGCp5RnV0QcQQIgJBRymnE2lo9M9fMSAv0PP36X7ixNVLV9vv73JFtdTCw="}]},"_npmUser":{"name":"ksoichiro","email":"soichiro.kashima@gmail.com"},"directories":{},"maintainers":[{"name":"ksoichiro","email":"soichiro.kashima@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rehype-img-size_0.0.2_1642728250810_0.4658084829185938"},"_hasShrinkwrap":false},"1.0.0":{"name":"rehype-img-size","version":"1.0.0","description":"rehype plugin to set local image size properties to img tag","license":"MIT","keywords":["rehype","rehype-plugin","image","size","html"],"engines":{"node":"^12.20.0 || ^14.13.1 || >=16.0.0"},"type":"module","repository":{"type":"git","url":"git+https://github.com/ksoichiro/rehype-img-size.git"},"bugs":{"url":"https://github.com/ksoichiro/rehype-img-size/issues"},"author":{"name":"Soichiro Kashima","email":"soichiro.kashima@gmail.com","url":"https://github.com/ksoichiro"},"main":"cjs/index.cjs","exports":{"import":"./index.js","require":"./cjs/index.cjs"},"types":"./index.d.ts","devDependencies":{"@rollup/plugin-commonjs":"^21.0.1","@rollup/plugin-node-resolve":"^13.1.3","jest":"^27.3.1","rehype-stringify":"^9.0.2","remark-parse":"^10.0.0","remark-rehype":"^10.0.1","rollup":"^2.64.0","to-vfile":"^7.2.2","unified":"^10.1.0","vfile-reporter":"^6.0.2"},"dependencies":{"image-size":"^1.0.0","unist-util-visit":"^4.1.0"},"scripts":{"postinstall":"(cd examples/cjs && npm i); (cd examples/esm && npm i); (cd examples/ts && npm i)","pretest":"(npm run build) && (cd examples/cjs && npm run build --if-present); (cd examples/esm && npm run build --if-present); (cd examples/ts && npm run build --if-present)","test":"node --experimental-vm-modules node_modules/jest/bin/jest.js --coverage","build":"rollup --config --file cjs/index.cjs"},"jest":{"collectCoverageFrom":["*.js"],"transform":{},"testPathIgnorePatterns":["<rootDir>/node_modules/","<rootDir>/cjs"]},"gitHead":"7aaa0ee1bd2ed6e1992a83c8d4696c3095ab8925","homepage":"https://github.com/ksoichiro/rehype-img-size#readme","_id":"rehype-img-size@1.0.0","_nodeVersion":"14.18.3","_npmVersion":"7.11.2","dist":{"integrity":"sha512-pbHyYWnCAcTDazhNNgjv6P4QZDXFyrFvRFNhqCLzI15H9dWZN3PEkYU6rc4KQFn10dXVTVmXw0G8t0VvCvdwRQ==","shasum":"73cfc1cb741028d8bd8b584593e009c99d7db166","tarball":"https://registry.npmjs.org/rehype-img-size/-/rehype-img-size-1.0.0.tgz","fileCount":6,"unpackedSize":56693,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh/IJRCRA9TVsSAnZWagAA+4YQAJRtBcXCZ1KT/E/h4Sgg\ndS0YIcSBNivf+2Uh+1YLRbQPg2gRtj9DJZXChCDA8aNDF1k25QEX/S0cST+Y\ndY8bQZNR+pNNLw7H+d+YqvZxF3J9+uVwMxWu4vm1zmGCITMyFCHPTK47YVBm\nWH2yp19wcYfxiGkE8s88iytZq7Lnr0Yl92+LwsaP2BF/KxIGC8RTtM7nkXKc\nna7+FKwSCKbXjLffD3sGJpcXvQyLudQDjQlIPslh0Mj5IUJwHUsEUSCNMldn\noENVaKqzN5JZ9zM/eTJebuj2e8AypIn7Gopt7XVUpGTxcU2eKboAVdfADJc2\nyf9H2WZSheO7IQ99RmprHxxKR4gx9/8duIwHj9e66TZ1UfekwV4p/T+/GMJH\n8lp1Wh+XTFYx+loOMs/JQ6yMTXDuvyRbQo76HMlAkGjOrfzW03tF3LounzOK\ndmXYTECiwQliAsbRQCK5A/diHkTgrOuD3etjE+F2UwtAgkViuMRYBFziKH0+\nHI4g/GRUOsQGzxA7cbb2w5fcB9pQvOyJmTzBn9Bdf5A9h5GB/u7Qlgq9QFzQ\nCfv351sijaG6RHzmVVs/Q3LFs7E84l91GCDXIs7aM4V3h0XuvGbXL5zZ+kK0\nVegGaQZCpDAC8BHjLxQZ9W7SZRTTUGwgmY2vFEsOskCuLUCNQVlcoXGynH2s\nX2Iw\r\n=wYjd\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCtRqBnHix+uKcEGpKW6Cyldl5nI5Ya2r3aXweW3rELqwIhAI0oh8AkOI+icmrwkMzF/II7wfj2P+D5hEhyWRO3W3Xq"}]},"_npmUser":{"name":"ksoichiro","email":"soichiro.kashima@gmail.com"},"directories":{},"maintainers":[{"name":"ksoichiro","email":"soichiro.kashima@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rehype-img-size_1.0.0_1643938385633_0.9308724881705623"},"_hasShrinkwrap":false},"1.0.1":{"name":"rehype-img-size","version":"1.0.1","description":"rehype plugin to set local image size properties to img tag","license":"MIT","keywords":["rehype","rehype-plugin","image","size","html"],"engines":{"node":"^12.20.0 || ^14.13.1 || >=16.0.0"},"type":"module","repository":{"type":"git","url":"git+https://github.com/ksoichiro/rehype-img-size.git"},"bugs":{"url":"https://github.com/ksoichiro/rehype-img-size/issues"},"author":{"name":"Soichiro Kashima","email":"soichiro.kashima@gmail.com","url":"https://github.com/ksoichiro"},"main":"cjs/index.cjs","exports":{"import":"./index.js","require":"./cjs/index.cjs"},"types":"./index.d.ts","devDependencies":{"@rollup/plugin-commonjs":"^21.0.1","@rollup/plugin-node-resolve":"^13.1.3","jest":"^27.3.1","rehype-stringify":"^9.0.2","remark-parse":"^10.0.0","remark-rehype":"^10.0.1","rollup":"^2.64.0","to-vfile":"^7.2.2","unified":"^10.1.0","vfile-reporter":"^6.0.2"},"dependencies":{"image-size":"^1.0.0","unist-util-visit":"^4.1.0"},"scripts":{"build:example":"(cd examples/cjs && npm i); (cd examples/esm && npm i); (cd examples/ts && npm i)","pretest":"(npm run build) && (cd examples/cjs && npm run build --if-present); (cd examples/esm && npm run build --if-present); (cd examples/ts && npm run build --if-present)","test":"node --experimental-vm-modules node_modules/jest/bin/jest.js --coverage","build":"rollup --config --file cjs/index.cjs"},"jest":{"collectCoverageFrom":["*.js"],"transform":{},"testPathIgnorePatterns":["<rootDir>/node_modules/","<rootDir>/cjs"]},"gitHead":"ffd967d32545bdadceaeed5f89603329991b13b7","homepage":"https://github.com/ksoichiro/rehype-img-size#readme","_id":"rehype-img-size@1.0.1","_nodeVersion":"14.18.3","_npmVersion":"7.11.2","dist":{"integrity":"sha512-+rLkxF2H3mQULAg3iA2Z2spJQlBcCpApG8sHC47bc0p33ol+ddz+O3gyUcTgk5xX5jGaj1oQOBs/cBy8nIIhoQ==","shasum":"13488d1500b778df1d98f32025fece2c1fa77b9c","tarball":"https://registry.npmjs.org/rehype-img-size/-/rehype-img-size-1.0.1.tgz","fileCount":6,"unpackedSize":56695,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh/IWTCRA9TVsSAnZWagAAmdAP/3mWxJ5kJlVhdXBD4LBE\nLLwzxg2mmrGgI3CTU1N8apEvhLWP+LOXJN7bHtYkAMHpzR7Qs2rLfkFYQ5Qa\nEVQNmO4/yseyXPEPhL6nl3nsfQrbuZ4VJCWoTctUVJ0MkvD0XIr5qQLU+gFA\nQYMoTYK4WCiJi2quWbUVMKZfQVnz70ardR7rskRpSsJDyz/2vktXwima7toZ\nuNNba2g4WZnv64evnGdXnlujeXxImH/LlRQkbZj6v/R43tKp2xo6/2+ti6ir\nV0zk22G484Fx4yIwra8Hk5mY2GO6T5gAIPRMBLGBJCOe4Scf0RV9RbCXEaQK\nAK9AP2uqkFPUsc7An33/j4LxXa+AJBmo4BQQr01DSGWlP74/lF10FrxyEoiJ\ns8BElcu3uv1WkhSYGp2ImBrfzMxXzo6MApPUedYZtNZcVCwOEWRNE6QZ2Vwc\nWh5npM9kQUR+ZxD3hPXLLBd+/gVYK48c86rPQz9Wavr9xmpexR7M5hM/CtVb\nE4p/pMQ/dj0xTrqg4kHhQuawrozKzCBOuQ1hdex1fcVAOZtriY50IXsH/tJF\n39mTWXFlL3htdZj2aAiYLLv7fPo0YES0igM2Fjz3vMTpGYofvFX8EjBTsvAJ\ntFsJ85KUY1Sv0sfKinAvloGF2K3VaS/uKxVvOhJI7/LezvPHz4tbI6deRNPE\nBZj+\r\n=V7a+\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICFqGOm0nABtHPfXmFUcosZvS3iqDXMHyRln3YkVOtRqAiEAxO3SD2zt/IuFMRGDOWtz46HTnLiAEB+Frz1N0+uN6sg="}]},"_npmUser":{"name":"ksoichiro","email":"soichiro.kashima@gmail.com"},"directories":{},"maintainers":[{"name":"ksoichiro","email":"soichiro.kashima@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rehype-img-size_1.0.1_1643939219062_0.8251412558012627"},"_hasShrinkwrap":false}},"time":{"created":"2021-03-20T05:56:54.545Z","0.0.1":"2021-03-20T05:56:54.756Z","modified":"2022-05-15T17:20:44.014Z","0.0.2":"2022-01-21T01:24:10.956Z","1.0.0":"2022-02-04T01:33:05.782Z","1.0.1":"2022-02-04T01:46:59.276Z"},"maintainers":[{"name":"ksoichiro","email":"soichiro.kashima@gmail.com"}],"description":"rehype plugin to set local image size properties to img tag","homepage":"https://github.com/ksoichiro/rehype-img-size#readme","keywords":["rehype","rehype-plugin","image","size","html"],"repository":{"type":"git","url":"git+https://github.com/ksoichiro/rehype-img-size.git"},"author":{"name":"Soichiro Kashima","email":"soichiro.kashima@gmail.com","url":"https://github.com/ksoichiro"},"bugs":{"url":"https://github.com/ksoichiro/rehype-img-size/issues"},"license":"MIT","readme":"# rehype-img-size\n\n[![main](https://github.com/ksoichiro/rehype-img-size/actions/workflows/main.yaml/badge.svg?branch=master)](https://github.com/ksoichiro/rehype-img-size/actions/workflows/main.yaml)\n[![codecov](https://codecov.io/gh/ksoichiro/rehype-img-size/branch/master/graph/badge.svg?token=71EXFOOV6T)](https://codecov.io/gh/ksoichiro/rehype-img-size)\n[![npm](https://img.shields.io/npm/v/rehype-img-size.svg)](https://www.npmjs.com/package/rehype-img-size)\n\n**[rehype](https://github.com/rehypejs/rehype)** plugin to set local image size properties to img tag.\n\nThis can be used to improve *Cumulative Layout Shift*: [Images without dimensions](https://web.dev/optimize-cls/#images-without-dimensions)\n\n## Install\n\n```\nnpm install rehype-img-size\n```\n\n## Use\n\nSay we have the following file, `index.md`:\n\n```markdown\n![](img.png)\n```\n\nAnd our script, `example.js`, looks as follows:\n\n```js\nimport {unified} from 'unified'\nimport parse from 'remark-parse'\nimport remark2rehype from 'remark-rehype'\nimport stringify from 'rehype-stringify'\nimport * as vfile from 'to-vfile'\nimport rehypeImgSize from 'rehype-img-size'\n\nunified()\n  .use(parse)\n  .use(remark2rehype)\n  .use(rehypeImgSize)\n  .use(stringify)\n  .process(vfile.readSync('index.md'), function(err, file) {\n    if (err) throw err\n    console.log(file.value)\n  })\n```\n\nNow, running `node example` yields:\n\n```html\n<p><img src=\"img.png\" alt=\"\" width=\"640\" height=\"480\"></p>\n```\n\nSee examples/esm directory for the entire code.\n\nYou can also keep using this as a CommonJS package. See examples/cjs directory.\n\n## API\n\n### `rehype().use(rehypeImgSize[, options])`\n\nAdd `width` and `height` properties to `img` tag which refers local image file.\nThis plugin read the target file to know the size of the image, so file path must be able to resolve.\n\nSupported formats depend on [image-size](https://www.npmjs.com/package/image-size).\n\n##### `options`\n\n###### `options.dir`\n\nDirectory to resolve image file path.\nThis is useful when Markdown files and image files are located in the separate directories.\n\n## nuxt/content\n\nIf you use this plugin for [nuxt/content](https://content.nuxtjs.org/), you can use it by configuring your `nuxt.config.js` like below:\n\n```js\ncontent: {\n  markdown: {\n    rehypePlugins: [\n      [ 'rehype-img-size', { dir: 'static' } ]\n    ],\n```\n\n## License\n\nMIT &copy; ksoichiro\n","readmeFilename":"readme.md"}