{"id":22322451,"url":"https://github.com/josestg/rehype-figure","last_synced_at":"2025-07-29T15:31:03.301Z","repository":{"id":50669416,"uuid":"289580322","full_name":"josestg/rehype-figure","owner":"josestg","description":"rehype plugins to support figure and caption","archived":false,"fork":false,"pushed_at":"2020-08-23T12:47:19.000Z","size":48,"stargazers_count":7,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-01T14:40:12.258Z","etag":null,"topics":["html-figcaption","html-figure","rehype","rehype-plugin","remark","remark-plugin","unifiedjs"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/rehype-figure","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/josestg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-08-22T23:02:05.000Z","updated_at":"2023-09-15T20:11:28.000Z","dependencies_parsed_at":"2022-09-10T02:23:38.710Z","dependency_job_id":null,"html_url":"https://github.com/josestg/rehype-figure","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josestg%2Frehype-figure","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josestg%2Frehype-figure/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josestg%2Frehype-figure/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josestg%2Frehype-figure/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/josestg","download_url":"https://codeload.github.com/josestg/rehype-figure/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227673978,"owners_count":17802299,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["html-figcaption","html-figure","rehype","rehype-plugin","remark","remark-plugin","unifiedjs"],"created_at":"2024-12-04T01:07:26.200Z","updated_at":"2024-12-04T01:07:26.804Z","avatar_url":"https://github.com/josestg.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rehype-figure\n\n[![Build Status](https://travis-ci.com/josestg/rehype-figure.svg?token=1ZtvVXXQrZXVL8domfez\u0026branch=master)](https://travis-ci.com/josestg/rehype-figure)\n![license](https://badgen.net/github/license/josestg/rehype-figure)\n![release](https://badgen.net/github/release/josestg/rehype-figure)\n![npm](https://badgen.net/npm/v/rehype-figure)\n\n[rehype](https://github.com/rehypejs/rehype) plugins to support figure and caption!\n\n## Install\n\n```shell\nnpm install rehype-figure\n\nor\n\nyarn add rehype-figure\n```\n\n## Use\n\n**Markdown:**\n\n```md\n# Images\n\nLorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua\n\n![This is a caption and image alt property](https://img.id/dog.png)\n![These two images will be children 'rehype-container'](https://img.id/cat.png)\n\nLorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua\n\n![These two images will be children 'rehype-container'](https://img.id/cat.png)\n```\n\n**rehype-figure:**\n\n```js\nconst unified = require(\"unified\")\nconst remark = require(\"remark-parse\")\nconst remark2rehype = require(\"remark-rehype\")\nconst stringify = require(\"rehype-stringify\")\nconst assert = require(\"assert\")\nconst vfile = require(\"to-vfile\")\n\nconst rehypeFigure = require(\"rehype-figure\")\n\nfunction compile(filename) {\n  return unified()\n    .use(remark)\n    .use(remark2rehype)\n    .use(rehypeFigure, { className: \"my-figure\" })\n    .use(stringify)\n    .processSync(vfile.readSync(\"./__example__/\" + filename))\n    .toString()\n}\n```\n\n**Yields:**\n\n```html\n\u003ch1\u003eImages\u003c/h1\u003e\n\u003cp\u003e\n  Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod\n  tempor incididunt ut labore et dolore magna aliqua\n\u003c/p\u003e\n\u003cdiv class=\"my-figure-container\"\u003e\n  \u003cfigure class=\"my-figure\"\u003e\n    \u003cimg\n      src=\"https://img.id/dog.png\"\n      alt=\"This is a caption and image alt property\"\n    /\u003e\n    \u003cfigcaption\u003eThis is a caption and image alt property\u003c/figcaption\u003e\n  \u003c/figure\u003e\n  \u003cfigure class=\"my-figure\"\u003e\n    \u003cimg\n      src=\"https://img.id/cat.png\"\n      alt=\"These two images will be children \u0026#x27;rehype-container\u0026#x27;\"\n    /\u003e\n    \u003cfigcaption\u003e\n      These two images will be children 'rehype-container'\n    \u003c/figcaption\u003e\n  \u003c/figure\u003e\n\u003c/div\u003e\n\u003cp\u003e\n  Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod\n  tempor incididunt ut labore et dolore magna aliqua\n\u003c/p\u003e\n\u003cfigure class=\"my-figure\"\u003e\n  \u003cimg\n    src=\"https://img.id/cat.png\"\n    alt=\"These two images will be children \u0026#x27;rehype-container\u0026#x27;\"\n  /\u003e\n  \u003cfigcaption\u003eThese two images will be children 'rehype-container'\u003c/figcaption\u003e\n\u003c/figure\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjosestg%2Frehype-figure","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjosestg%2Frehype-figure","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjosestg%2Frehype-figure/lists"}