{"id":15661303,"url":"https://github.com/jaywcjlove/rehype-rewrite","last_synced_at":"2026-03-03T07:41:58.102Z","repository":{"id":42540148,"uuid":"367808422","full_name":"jaywcjlove/rehype-rewrite","owner":"jaywcjlove","description":"Rewrite element with rehype.","archived":false,"fork":false,"pushed_at":"2026-02-12T16:09:05.000Z","size":267,"stargazers_count":25,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-13T00:28:26.291Z","etag":null,"topics":["html","markdown","rehype","rehype-plugin","rewrite"],"latest_commit_sha":null,"homepage":"https://jaywcjlove.github.io/rehype-rewrite","language":"TypeScript","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/jaywcjlove.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"ko_fi":"jaywcjlove","buy_me_a_coffee":"jaywcjlove","custom":["https://www.paypal.me/kennyiseeyou","https://jaywcjlove.github.io/#/sponsor"]}},"created_at":"2021-05-16T07:06:11.000Z","updated_at":"2026-02-12T16:13:23.000Z","dependencies_parsed_at":"2022-09-16T08:10:38.628Z","dependency_job_id":"8f2e6f50-4e38-4b18-8d1a-8884433241d0","html_url":"https://github.com/jaywcjlove/rehype-rewrite","commit_stats":{"total_commits":106,"total_committers":3,"mean_commits":"35.333333333333336","dds":0.2264150943396226,"last_synced_commit":"6dac3785206deac11c0b155c6e712aa5747f4787"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"purl":"pkg:github/jaywcjlove/rehype-rewrite","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaywcjlove%2Frehype-rewrite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaywcjlove%2Frehype-rewrite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaywcjlove%2Frehype-rewrite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaywcjlove%2Frehype-rewrite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jaywcjlove","download_url":"https://codeload.github.com/jaywcjlove/rehype-rewrite/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaywcjlove%2Frehype-rewrite/sbom","scorecard":{"id":509388,"data":{"date":"2025-08-11","repo":{"name":"github.com/jaywcjlove/rehype-rewrite","commit":"6dac3785206deac11c0b155c6e712aa5747f4787"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.8,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":0,"reason":"Found 0/22 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci.yml:1","Warn: no topLevel permission defined: .github/workflows/pr.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/jaywcjlove/rehype-rewrite/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/jaywcjlove/rehype-rewrite/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:51: update your workflow using https://app.stepsecurity.io/secureworkflow/jaywcjlove/rehype-rewrite/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:58: update your workflow using https://app.stepsecurity.io/secureworkflow/jaywcjlove/rehype-rewrite/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:65: update your workflow using https://app.stepsecurity.io/secureworkflow/jaywcjlove/rehype-rewrite/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:71: update your workflow using https://app.stepsecurity.io/secureworkflow/jaywcjlove/rehype-rewrite/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:74: update your workflow using https://app.stepsecurity.io/secureworkflow/jaywcjlove/rehype-rewrite/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:82: update your workflow using https://app.stepsecurity.io/secureworkflow/jaywcjlove/rehype-rewrite/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:89: update your workflow using https://app.stepsecurity.io/secureworkflow/jaywcjlove/rehype-rewrite/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pr.yml:9: update your workflow using https://app.stepsecurity.io/secureworkflow/jaywcjlove/rehype-rewrite/pr.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pr.yml:10: update your workflow using https://app.stepsecurity.io/secureworkflow/jaywcjlove/rehype-rewrite/pr.yml/main?enable=pin","Warn: npmCommand not pinned by hash: .github/workflows/ci.yml:21","Warn: npmCommand not pinned by hash: .github/workflows/ci.yml:44","Warn: npmCommand not pinned by hash: .github/workflows/pr.yml:16","Info:   0 out of   4 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   7 third-party GitHubAction dependencies pinned","Info:   0 out of   3 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 8 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-20T00:08:27.662Z","repository_id":42540148,"created_at":"2025-08-20T00:08:27.662Z","updated_at":"2025-08-20T00:08:27.662Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30036058,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-03T06:58:30.252Z","status":"ssl_error","status_checked_at":"2026-03-03T06:58:15.329Z","response_time":61,"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":["html","markdown","rehype","rehype-plugin","rewrite"],"created_at":"2024-10-03T13:26:56.082Z","updated_at":"2026-03-03T07:41:58.096Z","avatar_url":"https://github.com/jaywcjlove.png","language":"TypeScript","funding_links":["https://ko-fi.com/jaywcjlove","https://buymeacoffee.com/jaywcjlove","https://www.paypal.me/kennyiseeyou","https://jaywcjlove.github.io/#/sponsor"],"categories":[],"sub_categories":[],"readme":"\u003cdiv markdown=\"1\"\u003e\n  \u003csup\u003eUsing \u003ca href=\"https://wangchujiang.com/#/app\" target=\"_blank\"\u003emy app\u003c/a\u003e is also a way to \u003ca href=\"https://wangchujiang.com/#/sponsor\" target=\"_blank\"\u003esupport\u003c/a\u003e me:\u003c/sup\u003e\n  \u003cbr\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/6758053530\" title=\"Scap: Screenshot \u0026 Markup Edit for macOS\"\u003e\u003cimg alt=\"Scap: Screenshot \u0026 Markup Edit\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/scap.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/6757317079\" title=\"Screen Test for macOS\"\u003e\u003cimg alt=\"Screen Test\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/screen-test.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/Deskmark/6755948110\" title=\"Deskmark for macOS\"\u003e\u003cimg alt=\"Deskmark\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/deskmark.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/Keyzer/6500434773\" title=\"Keyzer for macOS\"\u003e\u003cimg alt=\"Keyzer\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/keyzer.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://github.com/jaywcjlove/vidwall-hub\" title=\"Vidwall Hub for macOS\"\u003e\u003cimg alt=\"Vidwall Hub\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/vidwall-hub.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/VidCrop/6752624705\" title=\"VidCrop for macOS\"\u003e\u003cimg alt=\"VidCrop\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/vidcrop.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/Vidwall/6747587746\" title=\"Vidwall for macOS\"\u003e\u003cimg alt=\"Vidwall\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/vidwall.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://wangchujiang.com/mousio-hint/\" title=\"Mousio Hint for macOS\"\u003e\u003cimg alt=\"Mousio Hint\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/mousio-hint.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/6746747327\" title=\"Mousio for macOS\"\u003e\u003cimg alt=\"Mousio\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/mousio.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/6745227444\" title=\"Musicer for macOS\"\u003e\u003cimg alt=\"Musicer\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/musicer.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/6743841447\" title=\"Audioer for macOS\"\u003e\u003cimg alt=\"Audioer\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/audioer.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/6744690194\" title=\"FileSentinel for macOS\"\u003e\u003cimg alt=\"FileSentinel\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/file-sentinel.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/6743495172\" title=\"FocusCursor for macOS\"\u003e\u003cimg alt=\"FocusCursor\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/focus-cursor.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/6742680573\" title=\"Videoer for macOS\"\u003e\u003cimg alt=\"Videoer\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/videoer.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/6740425504\" title=\"KeyClicker for macOS\"\u003e\u003cimg alt=\"KeyClicker\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/key-clicker.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/6739052447\" title=\"DayBar for macOS\"\u003e\u003cimg alt=\"DayBar\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/daybar.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/6739444407\" title=\"Iconed for macOS\"\u003e\u003cimg alt=\"Iconed\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/iconed.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/6737160756\" title=\"Mousio for macOS\"\u003e\u003cimg alt=\"Mousio\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/rightmenu-master.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/6723903021\" title=\"Paste Quick for macOS\"\u003e\u003cimg alt=\"Quick RSS\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/paste-quick.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/6670696072\" title=\"Quick RSS for macOS/iOS\"\u003e\u003cimg alt=\"Quick RSS\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/quick-rss.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/6670167443\" title=\"Web Serve for macOS\"\u003e\u003cimg alt=\"Web Serve\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/web-serve.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/6503953628\" title=\"Copybook Generator for macOS/iOS\"\u003e\u003cimg alt=\"Copybook Generator\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/copybook-generator.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/6471227008\" title=\"DevTutor for macOS/iOS\"\u003e\u003cimg alt=\"DevTutor for SwiftUI\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/devtutor.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/6479819388\" title=\"RegexMate for macOS/iOS\"\u003e\u003cimg alt=\"RegexMate\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/regex-mate.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/6479194014\" title=\"Time Passage for macOS/iOS\"\u003e\u003cimg alt=\"Time Passage\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/time-passage.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/6478772538\" title=\"IconizeFolder for macOS\"\u003e\u003cimg alt=\"Iconize Folder\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/iconize-folder.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/6478511402\" title=\"Textsound Saver for macOS/iOS\"\u003e\u003cimg alt=\"Textsound Saver\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/textsound-saver.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/6476924627\" title=\"Create Custom Symbols for macOS\"\u003e\u003cimg alt=\"Create Custom Symbols\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/create-custom-symbols.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/6476452351\" title=\"DevHub for macOS\"\u003e\u003cimg alt=\"DevHub\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/devhub.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/6476400184\" title=\"Resume Revise for macOS\"\u003e\u003cimg alt=\"Resume Revise\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/resume-revise.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/6472593276\" title=\"Palette Genius for macOS\"\u003e\u003cimg alt=\"Palette Genius\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/palette-genius.png\"\u003e\u003c/a\u003e\n  \u003ca target=\"_blank\" href=\"https://apps.apple.com/app/6470879005\" title=\"Symbol Scribe for macOS\"\u003e\u003cimg alt=\"Symbol Scribe\" height=\"52\" width=\"52\" src=\"https://wangchujiang.com/appicon/symbol-scribe.png\"\u003e\u003c/a\u003e\n\u003c/div\u003e\n\u003chr\u003e\n\nrehype-rewrite\n===\n\u003c!--rehype:style=display: flex; height: 230px; align-items: center; justify-content: center; font-size: 38px;--\u003e\n\n[![Buy me a coffee](https://img.shields.io/badge/Buy%20me%20a%20coffee-048754?logo=buymeacoffee)](https://jaywcjlove.github.io/#/sponsor)\n[![Downloads](https://img.shields.io/npm/dm/rehype-rewrite.svg?style=flat)](https://www.npmjs.com/package/rehype-rewrite)\n[![NPM version](https://img.shields.io/npm/v/rehype-rewrite.svg?style=flat)](https://npmjs.org/package/rehype-rewrite)\n[![Build](https://github.com/jaywcjlove/rehype-rewrite/actions/workflows/ci.yml/badge.svg)](https://github.com/jaywcjlove/rehype-rewrite/actions/workflows/ci.yml)\n[![Coverage Status](https://jaywcjlove.github.io/rehype-rewrite/badges.svg)](https://jaywcjlove.github.io/rehype-rewrite/lcov-report/)\n[![npm bundle size](https://img.shields.io/bundlephobia/minzip/rehype-rewrite)](https://bundlephobia.com/result?p=rehype-rewrite)\n[![Repo Dependents](https://badgen.net/github/dependents-repo/jaywcjlove/rehype-rewrite)](https://github.com/jaywcjlove/rehype-rewrite/network/dependents)\n\nRewrite element with [rehype](https://github.com/rehypejs/rehype).\n\n## Installation\n\nThis package is [ESM only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c): Node 12+ is needed to use it and it must be `import` instead of `require`.\n\n```bash\nnpm install rehype-rewrite\n```\n\n## Usage\n\n\u003e 🚧  Migrate from rehype-rewrite ~~v2.x~~\u003c!--rehype:style=color: red;--\u003e to `v3.x`\u003c!--rehype:style=background-color: #4caf50; color: #fff;--\u003e.\n\u003e \n\u003e ```diff\n\u003e rehype()\n\u003e - .use(rehypeRewrite, (node, index, parent) =\u003e {})\n\u003e + .use(rehypeRewrite, {\n\u003e +   rewrite: (node, index, parent) =\u003e {}\n\u003e + })\n\u003e ```\n\u003c!--rehype:style=border-left-color: #fddf4c;--\u003e\n\n\u003c!--rehype:--\u003e\n```js\nimport { rehype } from 'rehype';\nimport rehypeRewrite from 'rehype-rewrite';\nimport stringify from 'rehype-stringify';\n\nconst html = `\u003ch1\u003eheader\u003c/h1\u003e`;\nconst htmlStr = rehype()\n  .data('settings', { fragment: true })\n  .use(rehypeRewrite, {\n    rewrite: (node, index, parent) =\u003e {\n      if(node.type == 'text' \u0026\u0026 node.value == 'header') {\n        node.value = ''\n      }\n    }\n  })\n  .use(stringify)\n  .processSync(html)\n  .toString()\n```\n\n\u003e ```html\n\u003e \u003ch1\u003eheader\u003c/h1\u003e\n\u003e ```\n\u003e **`Output:`** \n\u003e \n\u003e ```html\n\u003e \u003ch1\u003e\u003c/h1\u003e\n\u003e ```\n\u003e \n\n## Options\n\n```ts\nimport { Plugin } from 'unified';\nimport { Root, Element, ElementContent, RootContent } from 'hast';\n/** Get the node tree source code string */\nexport declare const getCodeString: (data?: ElementContent[], code?: string) =\u003e string;\nexport declare type RehypeRewriteOptions = {\n  /**\n   * Select an element to be wrapped. Expects a string selector that can be passed to hast-util-select ([supported selectors](https://github.com/syntax-tree/hast-util-select/blob/master/readme.md#support)).\n   * If `selector` is not set then wrap will check for a body all elements.\n   */\n  selector?: string;\n  /** Rewrite Element. */\n  rewrite(node: Root | RootContent, index: number | null, parent: Root | Element | null): void;\n};\ndeclare const remarkRewrite: Plugin\u003c[RehypeRewriteOptions?], Root\u003e;\nexport default remarkRewrite;\n```\n\n### `selector?: string;`\n\nSelect an element to be wrapped. Expects a string selector that can be passed to hast-util-select ([supported selectors](https://github.com/syntax-tree/hast-util-select/blob/master/readme.md#support)). If `selector` is not set then wrap will check for a body all elements.\n\n### `rewrite(node, index, parent): void;`\n\nRewrite element.\n\n## Example\n\n### Example 1\n\n```js\nimport { rehype } from 'rehype';\nimport rehypeRewrite from 'rehype-rewrite';\nimport stringify from 'rehype-stringify';\n\nconst html = `\u003ch1\u003eheader\u003c/h1\u003e\u003ch1\u003eheader\u003c/h1\u003e\u003ch1 class=\"title3\"\u003eheader\u003c/h1\u003e`;\nconst htmlStr = rehype()\n  .data('settings', { fragment: true })\n  .use(rehypeRewrite, {\n    selector: 'h1',\n    rewrite: (node) =\u003e {\n      if (node.type === 'element') {\n        node.properties.className = 'test';\n      }\n    }\n  })\n  .use(stringify)\n  .processSync(html)\n  .toString()\n```\n\n\u003e ```html\n\u003e \u003ch1\u003eheader\u003c/h1\u003e\n\u003e \u003ch1\u003eheader\u003c/h1\u003e\n\u003e \u003ch1 class=\"title3\"\u003eheader\u003c/h1\u003e\n\u003e ```\n\u003e **`Output:`** \n\u003e \n\u003e ```html\n\u003e \u003ch1 class=\"test\"\u003eheader\u003c/h1\u003e\n\u003e \u003ch1 class=\"test\"\u003eheader\u003c/h1\u003e\n\u003e \u003ch1 class=\"test\"\u003eheader\u003c/h1\u003e\n\u003e ```\n\u003e\n\n### Example 2\n\n```js\nimport { rehype } from 'rehype';\nimport rehypeRewrite from 'rehype-rewrite';\nimport stringify from 'rehype-stringify';\n\nconst html = `\u003ch1\u003eheader\u003c/h1\u003e`;\nconst htmlStr = rehype()\n  .use(rehypeRewrite, {\n    rewrite: (node) =\u003e {\n      if (node.type == 'element' \u0026\u0026 node.tagName == 'body') {\n        node.properties = { ...node.properties, style: 'color:red;'}\n      }\n    }\n  })\n  .use(stringify)\n  .processSync(html)\n  .toString()\n```\n\n\u003e ```html\n\u003e \u003ch1\u003eheader\u003c/h1\u003e\n\u003e ```\n\u003e **`Output:`** \n\u003e \n\u003e ```html\n\u003e \u003chtml\u003e\u003chead\u003e\u003c/head\u003e\u003cbody style=\"color:red;\"\u003e\u003ch1\u003eheader\u003c/h1\u003e\u003c/body\u003e\u003c/html\u003e\n\u003e ```\n\u003e\n\n### Example 3\n\n```js\nimport { rehype } from 'rehype';\nimport rehypeRewrite from 'rehype-rewrite';\nimport stringify from 'rehype-stringify';\n\nconst html = `\u003ch1\u003ehello\u003c/h1\u003e`;\nconst htmlStr = rehype()\n  .data('settings', { fragment: true })\n  .use(rehypeRewrite, {\n    rewrite: (node) =\u003e {\n      if (node.type == 'element' \u0026\u0026 node.tagName == 'h1') {\n        node.children = [ ...node.children, {\n          type: 'element',\n          tagName: 'span',\n          properties: {},\n          children: [\n            {type: 'text', value: ' world'}\n          ]\n        }]\n      }\n    }\n  })\n  .use(stringify)\n  .processSync(html)\n  .toString()\n```\n\n\u003e ```html\n\u003e \u003ch1\u003ehello\u003c/h1\u003e\n\u003e ```\n\u003e **`Output:`** \n\u003e \n\u003e ```html\n\u003e \u003ch1\u003ehello\u003cspan\u003e world\u003c/span\u003e\u003c/h1\u003e\n\u003e ```\n\u003e \n\n### Example 4\n\n```js\nimport { unified } from 'unified';\nimport remarkParse from 'remark-parse';\nimport rehypeRaw from 'rehype-raw';\nimport remark2rehype from 'remark-rehype';\nimport rehypeRewrite from 'rehype-rewrite';\nimport stringify from 'rehype-stringify';\n\nconst html = `\u003ch1\u003ehello\u003c/h1\u003e`;\nconst htmlStr = unified()\n  .use(remarkParse)\n  .use(remark2rehype, { allowDangerousHtml: true })\n  .use(rehypeRaw)\n  .use(rehypeRewrite, {\n    rewrite: (node) =\u003e {\n      if (node.type == 'element' \u0026\u0026 node.tagName == 'h1') {\n        node.properties = { ...node.properties, style: 'color:red;' }\n      }\n    }\n  })\n  .use(stringify)\n  .processSync(html)\n  .toString()\n```\n\n\u003e ```html\n\u003e \u003ch1\u003ehello\u003c/h1\u003e\n\u003e ```\n\u003e\n\u003e **`Output:`** \n\u003e \n\u003e ```html\n\u003e \u003ch1 style=\"color:red;\"\u003eHello World!\u003c/h1\u003e\n\u003e ```\n\u003e \n\n## Related\n\n- [`rehype-video`](https://github.com/jaywcjlove/rehype-video) Add improved video syntax: links to `.mp4` and `.mov` turn into videos.\n- [`rehype-attr`](https://github.com/jaywcjlove/rehype-attr) New syntax to add attributes to Markdown.\n- [`rehype-ignore`](https://github.com/jaywcjlove/rehype-ignore) Ignore content display via HTML comments, Shown in GitHub readme, excluded in HTML.\n- [`remark-github-blockquote-alert`](https://github.com/jaywcjlove/remark-github-blockquote-alert) Remark plugin to add support for GitHub Alert.\n\n## Contributors\n\nAs always, thanks to our amazing contributors!\n\n\u003ca href=\"https://github.com/jaywcjlove/rehype-rewrite/graphs/contributors\"\u003e\n  \u003cimg src=\"https://jaywcjlove.github.io/rehype-rewrite/CONTRIBUTORS.svg\" /\u003e\n\u003c/a\u003e\n\nMade with [action-contributors](https://github.com/jaywcjlove/github-action-contributors).\n\n\n## License\n\nMIT © [Kenny Wong](https://github.com/jaywcjlove)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaywcjlove%2Frehype-rewrite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaywcjlove%2Frehype-rewrite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaywcjlove%2Frehype-rewrite/lists"}