{"id":15914664,"url":"https://github.com/daun/mark-external-links","last_synced_at":"2025-07-18T12:32:50.809Z","repository":{"id":132810902,"uuid":"284302780","full_name":"daun/mark-external-links","owner":"daun","description":"Add target and rel attributes to external links","archived":false,"fork":false,"pushed_at":"2020-08-10T21:49:27.000Z","size":20,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-03T03:44:24.322Z","etag":null,"topics":["external","javascript","links","newtab"],"latest_commit_sha":null,"homepage":"","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/daun.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-01T17:02:27.000Z","updated_at":"2024-07-07T18:58:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"8ab69e0b-5e01-47c1-ae4f-df0afc58887e","html_url":"https://github.com/daun/mark-external-links","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/daun/mark-external-links","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daun%2Fmark-external-links","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daun%2Fmark-external-links/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daun%2Fmark-external-links/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daun%2Fmark-external-links/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/daun","download_url":"https://codeload.github.com/daun/mark-external-links/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daun%2Fmark-external-links/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265760431,"owners_count":23824027,"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":["external","javascript","links","newtab"],"created_at":"2024-10-06T17:05:07.664Z","updated_at":"2025-07-18T12:32:50.777Z","avatar_url":"https://github.com/daun.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mark External Links\n\n[![NPM version](https://img.shields.io/npm/v/mark-external-links)](https://www.npmjs.com/package/mark-external-links)\n[![Bundle size](https://img.shields.io/bundlephobia/minzip/mark-external-links?label=size)](https://bundlephobia.com/result?p=mark-external-links)\n[![GitHub license](https://img.shields.io/github/license/daun/mark-external-links)](./LICENSE)\n![Travis Build](https://img.shields.io/travis/com/daun/mark-external-links)\n![Codecov](https://img.shields.io/codecov/c/github/daun/mark-external-links)\n\nAdd target and rel attributes to external links.\n\nAutomatically detects new links added to the document by installing a mutation\nobserver. This makes it safe to use when adding content via AJAX, using frontend\nframeworks, etc.\n\n**Before**\n\n```html\n\u003ca href=\"https://external.web\"\u003elink\u003c/a\u003e\n```\n\n**After**\n\n```html\n\u003ca href=\"https://external.web\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"\u003elink\u003c/a\u003e\n```\n\n## Installation\n\n```bash\nnpm install mark-external-links\n```\n\n## Usage\n\nImport and call `markExternalLinks()`.\n\n```js\nimport markExternalLinks from 'mark-external-links'\n\nmarkExternalLinks()\n```\n\n## Options\n\nAll options and their defaults:\n\n```js\nmarkExternalLinks({\n  target: '_blank',\n  rel: 'nofollow noopener noreferrer',\n  test: link =\u003e link.hostname !== window.location.hostname\n})\n```\n\n## In the browser\n\nIf you don't have the luxury of using a bundler, slap it in a script tag and\ncall it a day.\n\n```html\n\u003cscript src=\"https://unpkg.com/mark-external-links\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n  markExternalLinks.markExternalLinks()\n\u003c/script\u003e\n```\n\n## License\n\n[MIT](https://opensource.org/licenses/MIT)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaun%2Fmark-external-links","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaun%2Fmark-external-links","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaun%2Fmark-external-links/lists"}