{"id":27821494,"url":"https://github.com/rehypejs/rehype-dom","last_synced_at":"2026-04-02T01:36:14.952Z","repository":{"id":35028332,"uuid":"136067300","full_name":"rehypejs/rehype-dom","owner":"rehypejs","description":"HTML processor to parse and compile with browser APIs, powered by plugins","archived":false,"fork":false,"pushed_at":"2024-12-09T11:14:17.000Z","size":824,"stargazers_count":27,"open_issues_count":0,"forks_count":6,"subscribers_count":7,"default_branch":"main","last_synced_at":"2026-01-02T08:45:00.359Z","etag":null,"topics":["ast","browser","dom","html","javascript","rehype","rehype-plugin","unified"],"latest_commit_sha":null,"homepage":"https://unifiedjs.com","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rehypejs.png","metadata":{"funding":{"github":"unifiedjs","open_collective":"unified"},"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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-06-04T18:34:54.000Z","updated_at":"2025-03-27T07:08:36.000Z","dependencies_parsed_at":"2025-08-20T14:40:49.760Z","dependency_job_id":"56d4697c-efee-4bb3-89db-65b8fed32ee4","html_url":"https://github.com/rehypejs/rehype-dom","commit_stats":{"total_commits":95,"total_committers":6,"mean_commits":"15.833333333333334","dds":"0.17894736842105263","last_synced_commit":"c165c839aa918aad872a49592674ad3335a31d04"},"previous_names":["kmck/rehype-dom"],"tags_count":19,"template":false,"template_full_name":null,"purl":"pkg:github/rehypejs/rehype-dom","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rehypejs%2Frehype-dom","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rehypejs%2Frehype-dom/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rehypejs%2Frehype-dom/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rehypejs%2Frehype-dom/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rehypejs","download_url":"https://codeload.github.com/rehypejs/rehype-dom/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rehypejs%2Frehype-dom/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31293970,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-02T01:05:07.454Z","status":"ssl_error","status_checked_at":"2026-04-02T00:56:46.496Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["ast","browser","dom","html","javascript","rehype","rehype-plugin","unified"],"created_at":"2025-05-01T17:01:45.567Z","updated_at":"2026-04-02T01:36:14.937Z","avatar_url":"https://github.com/rehypejs.png","language":"JavaScript","funding_links":["https://github.com/sponsors/unifiedjs","https://opencollective.com/unified"],"categories":["Plugins"],"sub_categories":[],"readme":"# rehype-dom\n\n[![Build][build-badge]][build]\n[![Coverage][coverage-badge]][coverage]\n[![Downloads][downloads-badge]][downloads]\n[![Size][size-badge]][size]\n[![Sponsors][sponsors-badge]][collective]\n[![Backers][backers-badge]][collective]\n[![Chat][chat-badge]][chat]\n\nThis project is a monorepo that contains alternatives to [rehype][] for use in\nbrowsers.\n\n## Contents\n\n* [What is this?](#what-is-this)\n* [When should I use this?](#when-should-i-use-this)\n* [Example](#example)\n* [Security](#security)\n* [Contribute](#contribute)\n* [License](#license)\n\n## What is this?\n\nThis monorepo contains the following packages:\n\n* [`rehype-dom-parse`][rehype-dom-parse]\n  — plugin to take HTML as input and turn it into a syntax tree (hast) in\n  browsers\n* [`rehype-dom-stringify`][rehype-dom-stringify]\n  — plugin to take a syntax tree (hast) and turn it into HTML as output in\n  browsers\n* [`rehype-dom`][rehype-dom]\n  — `unified`, `rehype-dom-parse`, and `rehype-dom-stringify`, useful when\n  input and output are HTML\n\n## When should I use this?\n\nYou can use this project when you want to use rehype in browsers.\nIt has a smaller footprint in browsers compared to `rehype` itself as it uses\nDOM APIs to do its work.\nHowever, DOM APIs:\n\n* …cannot provide positional information (each node knowing where it\n  originated), which is frequently needed when working with rehype\n* …do not have formatting options that `rehype-stringify` exposes\n* …can provide varying results in different (especially older) browsers\n* …are safe, but untrusted HTML in browsers is always unsafe\n\n## Example\n\nSay our page `example.html` looks as follows:\n\n```html\n\u003c!doctype html\u003e\n\u003ctitle\u003eExample\u003c/title\u003e\n\u003cbody\u003e\n\u003cscript type=\"module\"\u003e\n  import {rehypeDom} from 'https://esm.sh/rehype-dom@7?bundle'\n\n  const file = await rehypeDom().process('\u003ch1\u003eHi \u003cdel\u003eMars\u003c/del\u003eVenus!\u003c/h1\u003e')\n\n  document.body.innerHTML = String(file)\n\u003c/script\u003e\n```\n\nNow running `open example.html` renders the following in `\u003cbody\u003e`:\n\n```html\n\u003ch1\u003eHi \u003cdel\u003eMars\u003c/del\u003eVenus!\u003c/h1\u003e\n```\n\n## Security\n\nUse of `rehype-dom` can open you up to a [cross-site scripting (XSS)][xss]\nattack if dangerous content is used and the result is used with the actual DOM.\nUse [`rehype-sanitize`][rehype-sanitize] to solve that.\n\n## Contribute\n\nSee [`contributing.md`][contributing] in [`rehypejs/.github`][health] for ways\nto get started.\nSee [`support.md`][support] for ways to get help.\n\nThis project has a [code of conduct][coc].\nBy interacting with this repository, organisation, or community you agree to\nabide by its terms.\n\n## License\n\n[ISC][license] © [Keith McKnight][author]\n\n\u003c!-- Definitions --\u003e\n\n[build-badge]: https://github.com/rehypejs/rehype-dom/workflows/main/badge.svg\n\n[build]: https://github.com/rehypejs/rehype-dom/actions\n\n[coverage-badge]: https://img.shields.io/codecov/c/github/rehypejs/rehype-dom.svg\n\n[coverage]: https://codecov.io/github/rehypejs/rehype-dom\n\n[downloads-badge]: https://img.shields.io/npm/dm/rehype-dom.svg\n\n[downloads]: https://www.npmjs.com/package/rehype-dom\n\n[size-badge]: https://img.shields.io/bundlejs/size/rehype-dom\n\n[size]: https://bundlejs.com/?q=rehype-dom\n\n[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg\n\n[backers-badge]: https://opencollective.com/unified/backers/badge.svg\n\n[collective]: https://opencollective.com/unified\n\n[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg\n\n[chat]: https://github.com/rehypejs/rehype/discussions\n\n[author]: https://keith.mcknig.ht\n\n[license]: license\n\n[health]: https://github.com/rehypejs/.github\n\n[contributing]: https://github.com/rehypejs/.github/blob/main/contributing.md\n\n[support]: https://github.com/rehypejs/.github/blob/main/support.md\n\n[coc]: https://github.com/rehypejs/.github/blob/main/code-of-conduct.md\n\n[rehype]: https://github.com/rehypejs/rehype\n\n[rehype-dom]: https://github.com/rehypejs/rehype-dom/tree/main/packages/rehype-dom\n\n[rehype-dom-parse]: https://github.com/rehypejs/rehype-dom/tree/main/packages/rehype-dom-parse\n\n[rehype-dom-stringify]: https://github.com/rehypejs/rehype-dom/tree/main/packages/rehype-dom-stringify\n\n[rehype-sanitize]: https://github.com/rehypejs/rehype-sanitize\n\n[xss]: https://en.wikipedia.org/wiki/Cross-site_scripting\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frehypejs%2Frehype-dom","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frehypejs%2Frehype-dom","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frehypejs%2Frehype-dom/lists"}