{"id":18830681,"url":"https://github.com/ssi02014/react-sanitizer-parser","last_synced_at":"2026-05-19T04:09:09.854Z","repository":{"id":187126269,"uuid":"676342264","full_name":"ssi02014/react-sanitizer-parser","owner":"ssi02014","description":"react-sanitizer-parser is a React element sanitizer parser.","archived":false,"fork":false,"pushed_at":"2023-08-09T17:58:13.000Z","size":2866,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-25T04:18:46.752Z","etag":null,"topics":["dompurify","html-react-parser","parser","react","xss"],"latest_commit_sha":null,"homepage":"https://github.com/ssi02014/react-sanitizer-parser","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ssi02014.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2023-08-09T01:53:46.000Z","updated_at":"2023-08-16T09:44:34.000Z","dependencies_parsed_at":"2024-12-30T06:43:25.097Z","dependency_job_id":"dc96e2a8-97ee-4ae1-bfed-956ca221614c","html_url":"https://github.com/ssi02014/react-sanitizer-parser","commit_stats":null,"previous_names":["ssi02014/react-sanitizer-parser"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ssi02014/react-sanitizer-parser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssi02014%2Freact-sanitizer-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssi02014%2Freact-sanitizer-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssi02014%2Freact-sanitizer-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssi02014%2Freact-sanitizer-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ssi02014","download_url":"https://codeload.github.com/ssi02014/react-sanitizer-parser/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssi02014%2Freact-sanitizer-parser/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267192919,"owners_count":24050604,"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","status":"online","status_checked_at":"2025-07-26T02:00:08.937Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["dompurify","html-react-parser","parser","react","xss"],"created_at":"2024-11-08T01:49:53.586Z","updated_at":"2026-05-19T04:09:04.818Z","avatar_url":"https://github.com/ssi02014.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 💻 react-sanitizer-parser\n\n\u003cp\u003e\n  \u003ca href=\"https://www.npmjs.com/package/react-sanitizer-parser\" target=\"_blank\"\u003e\n  \u003cimg src=\"https://img.shields.io/npm/v/react-sanitizer-parser.svg\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/react-sanitizer-parser\" target=\"_blank\"\u003e\n  \u003cimg src=\"https://img.shields.io/npm/dt/react-sanitizer-parser.svg\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cb\u003ereact-sanitizer-parser\u003c/b\u003e is a React element sanitizer parser that utilizes the [html-react-parser](https://github.com/remarkablemark/html-react-parser) and [dompurify](https://github.com/cure53/DOMPurify) libraries.\n\n## install\n```\nnpm install react-sanitizer-parser\n```\n```\nyarn add react-sanitizer-parser\n```\n\n## Usage\n```tsx\nimport ReactSanitizerParser from \"react-sanitizer-parser\";\n\nconst Example = () =\u003e {\n  const dirty = `\n    \u003cdiv\u003e\n      \u003cspan\u003e\n        React Sanitizer Parser\n      \u003c/span\u003e\n    \u003c/div\u003e\n  `;\n\n  return (\n    \u003cReactSanitizerParser\u003e{dirty}\u003c/ReactSanitizerParser\u003e\n  );\n}\n```\n\n### htmlParserOptions \u0026 sanitizerConfig\n- [html-react-parser Options](https://github.com/remarkablemark/html-react-parser#usage)\n- [DOMPurify Config](https://github.com/cure53/DOMPurify#can-i-configure-dompurify)\n\n```tsx\nimport ReactSanitizerParser from \"react-sanitizer-parser\";\n\nconst Example = () =\u003e {\n  const dirty = `\n    \u003cdiv\u003e\n      \u003cspan\u003e\n        React Sanitizer Parser\n      \u003c/span\u003e\n    \u003c/div\u003e\n  `;\n\n  return (\n    \u003cReactSanitizerParser \n      htmlParserOptions={{ /* ...html-react-parser options */ }} \n      sanitizerConfig={{ /* ...dompurify config*/}}\n    \u003e\n      {dirty}\n    \u003c/ReactSanitizerParser\u003e\n  );\n}\n```\n\n### parse, DOMPurify\nIf you need to, you can use the `parse` method of html-react-parser and DOMPurify's `DOMPurify` directly.\n\n```tsx\nimport ReactSanitizerParser, { parse, DOMPurify } from \"react-sanitizer-parser\";\n\nfunction App() {\n  console.log(DOMPurify.sanitize(\"\u003cimg src=x onerror=alert(1)//\u003e\")); // \u003cimg src=\"x\"\u003e\n  return (\n    \u003c\u003e\n      {parse(\"\u003cdiv\u003eReact\u003c/div\u003e\")}\n      \u003cReactSanitizerParser\u003e{`\u003cdiv\u003eReact\u003c/div\u003e`}\u003c/ReactSanitizerParser\u003e\n    \u003c/\u003e\n  );\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fssi02014%2Freact-sanitizer-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fssi02014%2Freact-sanitizer-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fssi02014%2Freact-sanitizer-parser/lists"}