{"_id":"remark-unlink-protocols","_rev":"2-ca24230d7ee05ce16be468cb513d29ab","name":"remark-unlink-protocols","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"remark-unlink-protocols","version":"1.0.0","keywords":["definitions","filter","links","markdown","mdast","plaintext","plugin","protocol","references","remark","remark-plugin","remove","text","unified"],"author":{"name":"Max","email":"max@nextcloud.com"},"license":"MIT","_id":"remark-unlink-protocols@1.0.0","maintainers":[{"name":"max-nextcloud","email":"max@nextcloud.com"}],"contributors":[],"homepage":"https://github.com/nextcloud-libraries/remark-unlink-protocols#readme","bugs":{"url":"https://github.com/nextcloud-libraries/remark-unlink-protocols/issues"},"xo":{"prettier":true,"overrides":[{"files":["test/**/*.js"],"rules":{"no-await-in-loop":"off"}}]},"dist":{"shasum":"ee7a29d495542fb66ad020c4ae60e9ca0ed490db","tarball":"https://registry.npmjs.org/remark-unlink-protocols/-/remark-unlink-protocols-1.0.0.tgz","fileCount":7,"integrity":"sha512-5j/F28jhFmxeyz8nuJYYIWdR4nNpKWZ8A+tVwnK/0pq7Rjue33CINEYSckSq2PZvedhKUwbn08qyiuGoPLBung==","signatures":[{"sig":"MEYCIQD5XpwNT/G72TuB6TWDu+ItV2WXh6BrNWslC+h+P4ONNwIhAJnn9PwrTHh6SrxhgKoQO9INOlEE7DkZkdqZtMiGqgDP","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":10293},"type":"module","types":"./index.d.ts","exports":"./index.js","gitHead":"ef8cda6474f9d63cbe5e60ba3825140643bf622f","scripts":{"test":"npm run build && npm run format && npm run test:coverage","build":"tsc --build --clean && tsc --build && type-coverage","format":"remark . --frail --output --quiet && prettier . --log-level warn --write && oxlint","prepack":"npm run build && npm run format","test:api":"node --conditions development test/index.js","test:coverage":"c8 --100 --reporter lcov npm run test:api"},"_npmUser":{"name":"max-nextcloud","email":"max@nextcloud.com"},"prettier":{"semi":false,"useTabs":false,"tabWidth":2,"singleQuote":true,"trailingComma":"none","bracketSpacing":false},"repository":{"url":"git+https://github.com/nextcloud-libraries/remark-unlink-protocols.git","type":"git"},"_npmVersion":"10.9.0","description":"remark plugin to remove links and references based on their protocol","directories":{},"sideEffects":false,"_nodeVersion":"20.11.0","dependencies":{"@types/mdast":"^4.0.0","unist-util-visit":"^5.0.0","mdast-squeeze-paragraphs":"^6.0.0"},"remarkConfig":{"plugins":["remark-preset-wooorm"]},"typeCoverage":{"detail":true,"strict":true,"atLeast":100,"ignoreCatch":true},"_hasShrinkwrap":false,"devDependencies":{"c8":"^10.1.3","oxlint":"^0.16.12","remark":"^15.0.0","prettier":"^3.0.0","remark-cli":"^12.0.1","typescript":"^5.0.0","@types/node":"^22.15.21","type-coverage":"^2.0.0","remark-preset-wooorm":"^11.0.0"},"_npmOperationalInternal":{"tmp":"tmp/remark-unlink-protocols_1.0.0_1748259088032_0.7473904559950462","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2025-05-26T11:31:28.031Z","modified":"2025-05-26T16:34:15.699Z","1.0.0":"2025-05-26T11:31:28.211Z"},"bugs":{"url":"https://github.com/nextcloud-libraries/remark-unlink-protocols/issues"},"author":{"name":"Max","email":"max@nextcloud.com"},"license":"MIT","homepage":"https://github.com/nextcloud-libraries/remark-unlink-protocols#readme","keywords":["definitions","filter","links","markdown","mdast","plaintext","plugin","protocol","references","remark","remark-plugin","remove","text","unified"],"repository":{"url":"git+https://github.com/nextcloud-libraries/remark-unlink-protocols.git","type":"git"},"description":"remark plugin to remove links and references based on their protocol","contributors":[],"maintainers":[{"email":"juliushaertl@gmail.com","name":"juliushaertl"},{"email":"max@nextcloud.com","name":"max-nextcloud"}],"readme":"<!--\n  - SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors\n  - SPDX-License-Identifier: MIT\n-->\n\n# remark-unlink-protocols\n\n[![REUSE status](https://api.reuse.software/badge/github.com/nextcloud-libraries/remark-unlink-protocol)](https://api.reuse.software/info/github.com/nextcloud-libraries/remark-unlink-protocol)\n\n**[remark][]** plugin to turn links into plain text based on their protocols.\n\n## Contents\n\n* [What is this?](#what-is-this)\n* [When should I use this?](#when-should-i-use-this)\n* [Install](#install)\n* [Use](#use)\n* [API](#api)\n* [Types](#types)\n* [Compatibility](#compatibility)\n* [Security](#security)\n* [Contribute](#contribute)\n* [License](#license)\n\n## What is this?\n\nThis package is a [unified][] ([remark][]) plugin to remove all links\nthat use other protocols than the ones specified\n(`http` and `https` by default).\n\n## When should I use this?\n\nThis project is useful if you want to limit the protocols\nthat can be linked to when processing markdown.\n\n## Install\n\nThis package is [ESM only][esm].\nIn Node.js (version 16+), install with [npm][]:\n\n```sh\nnpm install remark-unlink-protocols\n```\n\n## Use\n\nSay we have the following file `example.md` and apply `remark-unlink-protocols`\nwith the default protocols (`http` and `https`).\n\n```markdown\n# Uranus\n\n**Uranus** is the seventh [planet](/wiki/Planet 'Planet') from the Sun and is a\ngaseous cyan [ice giant](/wiki/Ice_giant 'Ice giant').\n\nPhotograph of Uranus in true colour by Voyager 2 in 1986:\n\n![This is an image of the planet Uranus taken by the spacecraft Voyager 2 in 1986.\nThe Voyager project is managed for NASA by the Jet Propulsion Laboratory.](<https://en.wikipedia.org/wiki/Uranus#/media/File:Uranus_as_seen_by_NASA's_Voyager_2_(remastered)_-_JPEG_converted.jpg>)\n\nSend comments to [me](mailto:test@domain.example)\n```\n\n…and a module `example.js`:\n\n```js\nimport {remark} from 'remark'\nimport remarkUnlinkProtocols from 'remark-unlink-protocols'\nimport {read} from 'to-vfile'\n\nconst file = await remark()\n  .use(remarkUnlinkProtocols, { except: 'mailto' })\n  .process(await read('example.md'))\n\nconsole.log(String(file))\n```\n\n…then running `node example.js` yields:\n\n```markdown\n# Uranus\n\n**Uranus** is the seventh planet from the Sun and is a\ngaseous cyan ice giant.\n\nPhotograph of Uranus in true colour by Voyager 2 in 1986:\n\n![This is an image of the planet Uranus taken by the spacecraft Voyager 2 in 1986.\nThe Voyager project is managed for NASA by the Jet Propulsion Laboratory.](<https://en.wikipedia.org/wiki/Uranus#/media/File:Uranus_as_seen_by_NASA's_Voyager_2_(remastered)_-_JPEG_converted.jpg>)\n\nThe Voyager project is managed for NASA by the Jet Propulsion\nLaboratory.\n\nSend comments to [me](mailto:test@domain.example).\n```\n\n## API\n\nThis package exports no identifiers.\nThe default export is `remarkUnlinkProtocols`.\n\n#### `unified().use(remarkUnlinkProtocols)`\n\nRemove all links and references that do not use the `http` or `https` protocols.\n\n###### Parameters\n\n`except`: `string[]` - protocols to keep - `['http', 'https']` by default.\n\n###### Returns\n\nTransform ([`Transformer`][unified-transformer]).\n\n## Types\n\nThis package is fully typed with [TypeScript][].\nIt exports no additional types.\n\n## Compatibility\n\nThe current release, `remark-unlink-protocols@^1` is compatible with Node.js 22.\n\nThis plugin works with `unified` version 3+ and `remark` version 4+.\n\n## Security\n\nUse of `remark-unlink-protocols` does not involve\n**[rehype][]** (**[hast][]**) or user content\nso there are no openings for [cross-site scripting (XSS)][wiki-xss]\nattacks.\n\n## Contribute\n\n[Nextcloud][nc-coc] and [Remarkjs][coc] have a code of conduct.\nBy interacting with the respective repositories, organization, or community\nyou agree to abide by its terms.\n\n## License\n\n[MIT][license] © 2025 Nextcloud GmbH and Nextcloud contributors\n\n[coc]: https://github.com/remarkjs/.github/blob/main/code-of-conduct.md\n\n[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n\n[hast]: https://github.com/syntax-tree/hast\n\n[license]: LICENSE\n\n[nc-coc]: https://nextcloud.com/contribute/code-of-conduct/\n\n[npm]: https://docs.npmjs.com/cli/install\n\n[rehype]: https://github.com/rehypejs/rehype\n\n[remark]: https://github.com/remarkjs/remark\n\n[typescript]: https://www.typescriptlang.org\n\n[unified]: https://github.com/unifiedjs/unified\n\n[unified-transformer]: https://github.com/unifiedjs/unified#transformer\n\n[wiki-xss]: https://en.wikipedia.org/wiki/Cross-site_scripting\n","readmeFilename":"readme.md"}