{"id":13502968,"url":"https://github.com/robinst/linkify","last_synced_at":"2025-05-14T18:04:15.696Z","repository":{"id":20869981,"uuid":"91151527","full_name":"robinst/linkify","owner":"robinst","description":"Rust library to find links such as URLs and email addresses in plain text, handling surrounding punctuation correctly","archived":false,"fork":false,"pushed_at":"2025-04-29T02:08:17.000Z","size":1610,"stargazers_count":219,"open_issues_count":11,"forks_count":12,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-05-07T20:11:22.722Z","etag":null,"topics":["linkify","rust","url"],"latest_commit_sha":null,"homepage":"https://robinst.github.io/linkify/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/robinst.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE-APACHE","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},"funding":{"github":"robinst"}},"created_at":"2017-05-13T05:24:15.000Z","updated_at":"2025-04-15T02:36:47.000Z","dependencies_parsed_at":"2024-01-18T23:26:06.136Z","dependency_job_id":"3c61286e-f7e2-4a2d-85e8-caf815a56c4a","html_url":"https://github.com/robinst/linkify","commit_stats":{"total_commits":195,"total_committers":9,"mean_commits":"21.666666666666668","dds":"0.24102564102564106","last_synced_commit":"dba37933d54f8367e2a068f523f451473f64541c"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robinst%2Flinkify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robinst%2Flinkify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robinst%2Flinkify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robinst%2Flinkify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robinst","download_url":"https://codeload.github.com/robinst/linkify/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254198452,"owners_count":22030964,"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":["linkify","rust","url"],"created_at":"2024-07-31T22:02:32.022Z","updated_at":"2025-05-14T18:04:15.590Z","avatar_url":"https://github.com/robinst.png","language":"Rust","funding_links":["https://github.com/sponsors/robinst"],"categories":["Rust"],"sub_categories":[],"readme":"Linkify\n=======\n\nLinkify is a Rust library to find links such as URLs and email addresses in\nplain text. It's smart about where a link ends, such as with trailing\npunctuation.\n\n[![Documentation](https://docs.rs/linkify/badge.svg)](https://docs.rs/linkify)\n[![Crate](https://img.shields.io/crates/v/linkify.svg)](https://crates.io/crates/linkify)\n[![ci](https://github.com/robinst/linkify/workflows/ci/badge.svg)](https://github.com/robinst/linkify/actions?query=workflow%3Aci)\n[![codecov](https://codecov.io/gh/robinst/linkify/branch/main/graph/badge.svg)](https://codecov.io/gh/robinst/linkify)\n\n## Introduction\n\nYour reaction might be: \"Do I need a library for this? Why not a regex?\".\nLet's look at a few cases:\n\n* In `http://example.com/.` the link should not include the trailing dot\n* `http://example.com/,` should not include the trailing comma\n* `(http://example.com/)` should not include the parens\n\nSeems simple enough. But then we also have these cases:\n\n* `https://en.wikipedia.org/wiki/Link_(The_Legend_of_Zelda)` should include the trailing paren\n* `http://üñîçøðé.com/ä` should also work for Unicode (including Emoji and Punycode)\n* `\u003chttp://example.com/\u003e` should not include angle brackets\n\nThis library behaves as you'd expect in the above cases and many more.\nIt uses a simple scan with linear runtime.\n\nIn addition to URLs, it can also find email addresses.\n\n## Demo 🧑‍🔬\n\nTry it out online on the demo playground (Rust compiled to WebAssembly):\nhttps://robinst.github.io/linkify/\n\nIf you want to use it on the command line, try [lychee](https://github.com/lycheeverse/lychee).\nIt uses linkify to extract all links and checks if they're valid, but it can also just print them like this:\n\n```shell\n$ echo 'Test https://example.org (and https://example.com)' | lychee --dump -\nhttps://example.org/\nhttps://example.com/\n```\n\n## Usage\n\nBasic usage:\n\n```rust\nextern crate linkify;\n\nuse linkify::{LinkFinder, LinkKind};\n\nlet input = \"Have you seen http://example.com?\";\nlet finder = LinkFinder::new();\nlet links: Vec\u003c_\u003e = finder.links(input).collect();\n\nassert_eq!(1, links.len());\nlet link = \u0026links[0];\n\nassert_eq!(\"http://example.com\", link.as_str());\nassert_eq!(14, link.start());\nassert_eq!(32, link.end());\nassert_eq!(\u0026LinkKind::Url, link.kind());\n```\n\nOption to allow URLs without schemes:\n\n```rust\nuse linkify::LinkFinder;\n\nlet input = \"Look, no scheme: example.org/foo\";\nlet mut finder = LinkFinder::new();\n\n// true by default\nfinder.url_must_have_scheme(false);\n\nlet links: Vec\u003c_\u003e = finder.links(input).collect();\nassert_eq!(links[0].as_str(), \"example.org/foo\");\n```\n\nRestrict the kinds of links:\n\n```rust\nuse linkify::{LinkFinder, LinkKind};\n\nlet input = \"http://example.com and foo@example.com\";\nlet mut finder = LinkFinder::new();\nfinder.kinds(\u0026[LinkKind::Email]);\nlet links: Vec\u003c_\u003e = finder.links(input).collect();\n\nassert_eq!(1, links.len());\nlet link = \u0026links[0];\nassert_eq!(\"foo@example.com\", link.as_str());\nassert_eq!(\u0026LinkKind::Email, link.kind());\n```\n\nSee full documentation on [docs.rs](https://docs.rs/linkify).\n\n## Conformance\n\nThis crates makes an effort to respect the various standards, namely:\n\n* [RFC 3986] and [RFC 3987] for URLs\n* [RFC 5321] and [RFC 6531] for email addresses (except IP addresses and quoting)\n\nAt the same time, it does not guarantee that the returned links are valid.\nIf in doubt, it rather returns a link than skipping it.\n\nIf you need to validate URLs, e.g. for checking TLDs, use another library on\nthe returned links.\n\n## Contributing\n\nPull requests, issues and comments welcome! Make sure to add tests for\nnew features and bug fixes.\n\n## License\n\nLinkify is distributed under the terms of both the MIT license and the\nApache License (Version 2.0). See [LICENSE-APACHE](LICENSE-APACHE) and\n[LICENSE-MIT](LICENSE-MIT) for details. Opening a pull requests is\nassumed to signal agreement with these licensing terms.\n\n[RFC 3986]: https://datatracker.ietf.org/doc/html/rfc3986\n[RFC 3987]: https://datatracker.ietf.org/doc/html/rfc3987\n[RFC 5321]: https://datatracker.ietf.org/doc/html/rfc5321\n[RFC 6531]: https://datatracker.ietf.org/doc/html/rfc6531\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobinst%2Flinkify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobinst%2Flinkify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobinst%2Flinkify/lists"}