{"id":24983675,"url":"https://github.com/posthtml/posthtml-noopener","last_synced_at":"2025-04-11T20:51:23.937Z","repository":{"id":43981775,"uuid":"194198773","full_name":"posthtml/posthtml-noopener","owner":"posthtml","description":"PostHTML plugin to add 'rel=\"noopener noreferrer\"' to links that open in a new tab","archived":false,"fork":false,"pushed_at":"2023-06-06T02:03:45.000Z","size":343,"stargazers_count":5,"open_issues_count":1,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-29T21:06:06.637Z","etag":null,"topics":["noopener","noreferrer","posthtml","posthtml-plugin"],"latest_commit_sha":null,"homepage":"","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/posthtml.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2019-06-28T03:17:25.000Z","updated_at":"2022-02-19T11:52:09.000Z","dependencies_parsed_at":"2022-09-26T17:01:23.512Z","dependency_job_id":null,"html_url":"https://github.com/posthtml/posthtml-noopener","commit_stats":{"total_commits":99,"total_committers":3,"mean_commits":33.0,"dds":0.4040404040404041,"last_synced_commit":"b8d34881f7cfb29c46159c48e5753485d8edbba7"},"previous_names":["metonym/posthtml-noopener"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posthtml%2Fposthtml-noopener","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posthtml%2Fposthtml-noopener/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posthtml%2Fposthtml-noopener/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posthtml%2Fposthtml-noopener/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/posthtml","download_url":"https://codeload.github.com/posthtml/posthtml-noopener/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247305932,"owners_count":20917208,"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":["noopener","noreferrer","posthtml","posthtml-plugin"],"created_at":"2025-02-04T09:20:16.385Z","updated_at":"2025-04-11T20:51:23.899Z","avatar_url":"https://github.com/posthtml.png","language":"TypeScript","readme":"# posthtml-noopener \u003cimg align=\"right\" width=\"220\" height=\"200\" title=\"PostHTML logo\" src=\"http://posthtml.github.io/posthtml/logo.svg\"\u003e\n\n[![NPM][npm]][npm-url]\n\n`posthtml-noopener` is a [PostHTML](https://github.com/posthtml/posthtml) plugin to add `rel=\"noopener noreferrer\"` to links that open in a new tab.\n\nAnchor links with the `target=\"_blank\"` attribute [are recommended to include](https://developers.google.com/web/tools/lighthouse/audits/noopener) a `rel=\"noopener\"` or `rel=\"noreferrer\"` attribute to [protect against cross-origin sites](https://mathiasbynens.github.io/rel-noopener/) from exploiting `window.opener`. By default, this plugin includes both attribute values.\n\n**Before:**\n\n```html\n\u003ca href=\"http://example.com/\" target=\"_blank\"\u003eLink\u003c/a\u003e\n```\n\n**After:**\n\n```html\n\u003ca href=\"http://example.com/\" target=\"_blank\" rel=\"noopener noreferrer\"\u003eLink\u003c/a\u003e\n```\n\n## Installation\n\n```bash\n# Yarn\nyarn add -D posthtml-noopener\n\n# NPM\nnpm i -D posthtml-noopener\n\n# pnpm\npnpm i -D posthtml-noopener\n```\n\n## Usage\n\n```js\nconst fs = require(\"fs\");\nconst posthtml = require(\"posthtml\");\nconst { noopener } = require(\"posthtml-noopener\");\n\nconst html = fs.readFileSync(\"./index.html\");\n\nposthtml()\n  .use(noopener())\n  .process(html)\n  .then((result) =\u003e fs.writeFileSync(\"./after.html\", result.html));\n```\n\n## Contributing\n\nSee the [PostHTML Guidelines](https://github.com/posthtml/posthtml/tree/master/docs).\n\n## [Changelog](CHANGELOG.md)\n\n## License\n\n[MIT](LICENSE)\n\n[npm]: https://img.shields.io/npm/v/posthtml-noopener.svg?color=blue\n[npm-url]: https://npmjs.com/package/posthtml-noopener\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fposthtml%2Fposthtml-noopener","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fposthtml%2Fposthtml-noopener","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fposthtml%2Fposthtml-noopener/lists"}