{"id":24203623,"url":"https://github.com/tsutsu3/linkify-it-py","last_synced_at":"2026-03-01T09:05:23.397Z","repository":{"id":38007876,"uuid":"308944657","full_name":"tsutsu3/linkify-it-py","owner":"tsutsu3","description":"Links recognition library with full unicode support ","archived":false,"fork":false,"pushed_at":"2025-03-09T14:30:38.000Z","size":134,"stargazers_count":18,"open_issues_count":2,"forks_count":8,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-31T14:58:53.639Z","etag":null,"topics":["autolink","autolinker","linkifier","linkify"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tsutsu3.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-31T18:13:41.000Z","updated_at":"2025-03-09T14:24:51.000Z","dependencies_parsed_at":"2024-06-18T22:36:06.071Z","dependency_job_id":"3c637f66-d774-49e0-8c05-ee5beaf4847c","html_url":"https://github.com/tsutsu3/linkify-it-py","commit_stats":{"total_commits":47,"total_committers":3,"mean_commits":"15.666666666666666","dds":0.1063829787234043,"last_synced_commit":"d6ce72bda8b6fdf2601f1a3a9ffb064b233717b6"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsutsu3%2Flinkify-it-py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsutsu3%2Flinkify-it-py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsutsu3%2Flinkify-it-py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsutsu3%2Flinkify-it-py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tsutsu3","download_url":"https://codeload.github.com/tsutsu3/linkify-it-py/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247234921,"owners_count":20905854,"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":["autolink","autolinker","linkifier","linkify"],"created_at":"2025-01-13T22:36:41.524Z","updated_at":"2026-03-01T09:05:23.306Z","avatar_url":"https://github.com/tsutsu3.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# linkify-it-py\n\n[![CI](https://github.com/tsutsu3/linkify-it-py/workflows/CI/badge.svg?branch=main)](https://github.com/tsutsu3/linkify-it-py/actions)\n[![pypi](https://img.shields.io/pypi/v/linkify-it-py)](https://pypi.org/project/linkify-it-py/)\n[![Anaconda-Server Badge](https://anaconda.org/conda-forge/linkify-it-py/badges/version.svg)](https://anaconda.org/conda-forge/linkify-it-py)\n[![Documentation Status](https://readthedocs.org/projects/linkify-it-py/badge/?version=latest)](https://linkify-it-py.readthedocs.io/en/latest/?badge=latest)\n[![codecov](https://codecov.io/gh/tsutsu3/linkify-it-py/branch/main/graph/badge.svg)](https://codecov.io/gh/tsutsu3/linkify-it-py)\n[![Maintainability](https://api.codeclimate.com/v1/badges/6341fd3ec5f05fde392f/maintainability)](https://codeclimate.com/github/tsutsu3/linkify-it-py/maintainability)\n\nThis is Python port of [linkify-it](https://github.com/markdown-it/linkify-it).\n\n\u003e Links recognition library with FULL unicode support.\n\u003e Focused on high quality link patterns detection in plain text.\n\n__[Demo](https://linkify-it-py-demo.vercel.app/)__\n\n__[Javascript Demo](http://markdown-it.github.io/linkify-it/)__\n\nWhy it's awesome:\n\n- Full unicode support, _with astral characters_!\n- International domains support.\n- Allows rules extension \u0026 custom normalizers.\n\n\n## Install\n\n```bash\npip install linkify-it-py\n```\n\nor\n\n```bash\nconda install -c conda-forge linkify-it-py\n```\n\n## Usage examples\n\n### Example 1. Simple use\n\n```python\nfrom linkify_it import LinkifyIt\n\n\nlinkify = LinkifyIt()\n\nprint(linkify.test(\"Site github.com!\"))\n# =\u003e True\n\nprint(linkify.match(\"Site github.com!\"))\n# =\u003e [linkify_it.main.Match({\n#         'schema': '',\n#         'index': 5,\n#         'last_index': 15,\n#         'raw': 'github.com',\n#         'text': 'github.com',\n#         'url': 'http://github.com'\n#     }]\n```\n\n### Example 2. With options\n\n```python\nfrom linkify_it import LinkifyIt\nfrom linkify_it.tlds import TLDS\n\n\n# Reload full tlds list \u0026 add unofficial `.onion` domain.\nlinkify = (\n    LinkifyIt()\n    .tlds(TLDS)               # Reload with full tlds list\n    .tlds(\"onion\", True)      # Add unofficial `.onion` domain\n    .add(\"git:\", \"http:\")     # Add `git:` protocol as \"alias\"\n    .add(\"ftp:\", None)        # Disable `ftp:` protocol\n    .set({\"fuzzy_ip\": True})  # Enable IPs in fuzzy links (without schema)\n)\nprint(linkify.test(\"Site tamanegi.onion!\"))\n# =\u003e True\n\nprint(linkify.match(\"Site tamanegi.onion!\"))\n# =\u003e [linkify_it.main.Match({\n#         'schema': '',\n#         'index': 5,\n#         'last_index': 19,\n#         'raw': 'tamanegi.onion',\n#         'text': 'tamanegi.onion',\n#         'url': 'http://tamanegi.onion'\n#     }]\n```\n\n### Example 3. Add twitter mentions handler\n\n```python\nfrom linkify_it import LinkifyIt\n\n\nlinkify = LinkifyIt()\n\ndef validate(obj, text, pos):\n    tail = text[pos:]\n\n    if not obj.re.get(\"twitter\"):\n        obj.re[\"twitter\"] = re.compile(\n            \"^([a-zA-Z0-9_]){1,15}(?!_)(?=$|\" + obj.re[\"src_ZPCc\"] + \")\"\n        )\n    if obj.re[\"twitter\"].search(tail):\n        if pos \u003e 2 and tail[pos - 2] == \"@\":\n            return False\n        return len(obj.re[\"twitter\"].search(tail).group())\n    return 0\n\ndef normalize(obj, match):\n    match.url = \"https://twitter.com/\" + re.sub(r\"^@\", \"\", match.url)\n\nlinkify.add(\"@\", {\"validate\": validate, \"normalize\": normalize})\n```\n\n\n## API\n\n[API documentation](https://linkify-it-py.readthedocs.io/en/latest/)\n\n### LinkifyIt(schemas, options)\n\nCreates new linkifier instance with optional additional schemas.\n\nBy default understands:\n\n- `http(s)://...` , `ftp://...`, `mailto:...` \u0026 `//...` links\n- \"fuzzy\" links and emails (google.com, foo@bar.com).\n\n`schemas` is an dict, where each key/value describes protocol/rule:\n\n- __key__ - link prefix (usually, protocol name with `:` at the end, `skype:`\n  for example). `linkify-it-py` makes sure that prefix is not preceded with\n  alphanumeric char.\n- __value__ - rule to check tail after link prefix\n  - _str_\n    - just alias to existing rule\n  - _dict_\n    - _validate_ - either a `re.Pattern` (start with `^`, and don't include the\n      link prefix itself), or a validator `function` which, given arguments\n      _self_, _text_ and _pos_, returns the length of a match in _text_\n      starting at index _pos_.  _pos_ is the index right after the link prefix.\n      _self_ can be used to access the linkify object to cache data.\n    - _normalize_ - optional function to normalize text \u0026 url of matched result\n      (for example, for twitter mentions).\n\n`options`:\n\n- __fuzzy_link__ - recognize URL-s without `http(s)://` head. Default `True`.\n- __fuzzy_ip__ - allow IPs in fuzzy links above. Can conflict with some texts\n  like version numbers. Default `False`.\n- __fuzzy_email__ - recognize emails without `mailto:` prefix. Default `True`.\n- __---__ - set `True` to terminate link with `---` (if it's considered as long dash).\n\n\n### .test(text)\n\nSearches linkifiable pattern and returns `True` on success or `False` on fail.\n\n\n### .pretest(text)\n\nQuick check if link MAY BE can exist. Can be used to optimize more expensive\n`.test()` calls. Return `False` if link can not be found, `True` - if `.test()`\ncall needed to know exactly.\n\n\n### .test_schema_at(text, name, position)\n\nSimilar to `.test()` but checks only specific protocol tail exactly at given\nposition. Returns length of found pattern (0 on fail).\n\n\n### .match(text)\n\nReturns `list` of found link matches or null if nothing found.\n\nEach match has:\n\n- __schema__ - link schema, can be empty for fuzzy links, or `//` for\n  protocol-neutral links.\n- __index__ - offset of matched text\n- __last_index__ - index of next char after mathch end\n- __raw__ - matched text\n- __text__ - normalized text\n- __url__ - link, generated from matched text\n\n### .matchAtStart(text)\n\nChecks if a match exists at the start of the string. Returns `Match`\n(see docs for `match(text)`) or null if no URL is at the start.\nDoesn't work with fuzzy links.\n\n### .tlds(list_tlds, keep_old=False)\n\nLoad (or merge) new tlds list. Those are needed for fuzzy links (without schema)\nto avoid false positives. By default:\n\n- 2-letter root zones are ok.\n- biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф are ok.\n- encoded (`xn--...`) root zones are ok.\n\nIf that's not enough, you can reload defaults with more detailed zones list.\n\n### .add(key, value)\n\nAdd a new schema to the schemas object. As described in the constructor\ndefinition, `key` is a link prefix (`skype:`, for example), and `value`\nis a `str` to alias to another schema, or an `dict` with `validate` and\noptionally `normalize` definitions.  To disable an existing rule, use\n`.add(key, None)`.\n\n\n### .set(options)\n\nOverride default options. Missed properties will not be changed.\n\n\n## License\n\n[MIT](https://github.com/tsutsu3/linkify-it-py/blob/master/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftsutsu3%2Flinkify-it-py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftsutsu3%2Flinkify-it-py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftsutsu3%2Flinkify-it-py/lists"}