{"id":26518801,"url":"https://github.com/daGrevis/mdx_linkify","last_synced_at":"2025-03-21T10:02:29.411Z","repository":{"id":54019988,"uuid":"8239764","full_name":"daGrevis/mdx_linkify","owner":"daGrevis","description":"Link recognition for Python Markdown","archived":false,"fork":false,"pushed_at":"2021-03-10T09:26:45.000Z","size":62,"stargazers_count":24,"open_issues_count":1,"forks_count":12,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-07-25T04:34:37.483Z","etag":null,"topics":["extension","linkify","markdown","python","urlify"],"latest_commit_sha":null,"homepage":null,"language":"Python","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/daGrevis.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}},"created_at":"2013-02-16T18:32:03.000Z","updated_at":"2023-09-08T16:37:46.000Z","dependencies_parsed_at":"2022-08-13T06:01:17.669Z","dependency_job_id":null,"html_url":"https://github.com/daGrevis/mdx_linkify","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daGrevis%2Fmdx_linkify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daGrevis%2Fmdx_linkify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daGrevis%2Fmdx_linkify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daGrevis%2Fmdx_linkify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/daGrevis","download_url":"https://codeload.github.com/daGrevis/mdx_linkify/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244776331,"owners_count":20508506,"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":["extension","linkify","markdown","python","urlify"],"created_at":"2025-03-21T10:02:27.972Z","updated_at":"2025-03-21T10:02:29.384Z","avatar_url":"https://github.com/daGrevis.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# Mdx Linkify\n\n[![Travis](https://img.shields.io/travis/daGrevis/mdx_linkify.svg)](https://travis-ci.org/daGrevis/mdx_linkify)\n[![Coveralls](https://img.shields.io/coveralls/daGrevis/mdx_linkify.svg)](https://coveralls.io/r/daGrevis/mdx_linkify?branch=master)\n[![PyPI](https://img.shields.io/pypi/v/mdx_linkify.svg)](https://pypi.python.org/pypi/mdx_linkify)\n[![PyPI](https://img.shields.io/pypi/pyversions/mdx_linkify.svg)](https://pypi.python.org/pypi/mdx_linkify)\n\nThis extension for [Python Markdown](https://github.com/waylan/Python-Markdown)\nwill convert text that look like links to HTML anchors.\n\nThere's an alternative package that serves the same purpose called\n[`markdown-urlize`](https://github.com/r0wb0t/markdown-urlize). The main\ndifference is that [`mdx_linkify`](https://github.com/daGrevis/mdx_linkify) is\nutilizing the excellent [`bleach`](https://github.com/jsocol/bleach) for\nsearching links in text. :clap:\n\n## Usage\n\n### Minimal Example\n\n```python\nfrom markdown import markdown\n\nmarkdown(\"minimal http://example.org/\", extensions=[\"mdx_linkify\"])\n# Returns '\u003cp\u003eminimal \u003ca href=\"http://example.org/\"\u003ehttp://example.org/\u003c/a\u003e\u003c/p\u003e'\n```\n\n## Installation\n\nThe project is [on PyPI](https://pypi.python.org/pypi/mdx_linkify)!\n\n    pip install mdx_linkify\n\nIf you want the bleeding-edge version (this includes unreleased-to-PyPI code),\nyou can always grab the master branch directly from Git.\n\n    pip install git+git://github.com/daGrevis/mdx_linkify.git\n\n### Configuring Linker\n\nTo configure used Linker instance, use `linker_options` parameter. It will be passed to [`bleach.linkifier.Linker`](https://bleach.readthedocs.io/en/latest/linkify.html#using-bleach-linkifier-linker) unchanged.\n\n\n#### Example: Parse Emails\n\n```python\nfrom mdx_linkify.mdx_linkify import LinkifyExtension\nfrom markdown import Markdown\n\nmd = Markdown(\n    extensions=[LinkifyExtension(linker_options={\"parse_email\": True})],\n)\n\nassert md.convert('contact@example.com') == '\u003cp\u003e\u003ca href=\"mailto:contact@example.com\"\u003econtact@example.com\u003c/a\u003e\u003c/p\u003e'\n```\n\n#### Example: Custom TLDs\n\n```python\nfrom mdx_linkify.mdx_linkify import LinkifyExtension\nfrom bleach.linkifier import build_url_re\nfrom markdown import Markdown\n\nmd = Markdown(\n    extensions=[LinkifyExtension(linker_options={\"url_re\": build_url_re([\"custom\", \"custom2\"])})],\n)\n\nassert md.convert('linked.custom') == '\u003cp\u003e\u003ca href=\"http://linked.custom\" rel=\"nofollow\"\u003elinked.custom\u003c/a\u003e\u003c/p\u003e'\n```\n\n#### Example: Ignoring TLDs\n\n```python\nfrom mdx_linkify.mdx_linkify import LinkifyExtension\nfrom markdown import Markdown\n\ndef dont_linkify_net_tld(attrs, new=False):\n    if attrs[\"_text\"].endswith(\".net\"):\n        return None\n\n    return attrs\n\nmd = Markdown(\n    extensions=[LinkifyExtension(linker_options={\"callbacks\": [dont_linkify_net_tld]})],\n)\n\nassert md.convert(\"not-linked.net\") == '\u003cp\u003enot-linked.net\u003c/p\u003e'\n```\n\n## Development\n\n```\ngit clone git@github.com:daGrevis/mdx_linkify.git\nvirtualenv mdx_linkify/\ncd mdx_linkify/\nsource bin/activate\npython setup.py install\npython setup.py test\n```\n\nPull requests are much welcome! :+1:\n\n## Releasing\n\n_(more like a cheatsheet for me actually)_\n\n- Change version in `setup.py`,\n- Commit and tag it,\n- Push it (including tag),\n- Run `python setup.py register \u0026\u0026 python setup.py sdist upload`;\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FdaGrevis%2Fmdx_linkify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FdaGrevis%2Fmdx_linkify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FdaGrevis%2Fmdx_linkify/lists"}