{"id":13828308,"url":"https://github.com/thephpleague/commonmark-ext-autolink","last_synced_at":"2025-07-09T06:31:26.891Z","repository":{"id":62516652,"uuid":"175726074","full_name":"thephpleague/commonmark-ext-autolink","owner":"thephpleague","description":"Extension for league/commonmark which autolinks URLs, emails, and @-mentions","archived":true,"fork":false,"pushed_at":"2020-04-04T14:21:14.000Z","size":58,"stargazers_count":13,"open_issues_count":0,"forks_count":3,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-06-28T13:53:00.299Z","etag":null,"topics":["autolink","commonmark","commonmark-extension","gfm","github-flavored-markdown","markdown","php"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thephpleague.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"colinodell","patreon":"colinodell"}},"created_at":"2019-03-15T01:22:51.000Z","updated_at":"2025-06-06T04:17:39.000Z","dependencies_parsed_at":"2022-11-02T10:31:11.157Z","dependency_job_id":null,"html_url":"https://github.com/thephpleague/commonmark-ext-autolink","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/thephpleague/commonmark-ext-autolink","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thephpleague%2Fcommonmark-ext-autolink","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thephpleague%2Fcommonmark-ext-autolink/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thephpleague%2Fcommonmark-ext-autolink/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thephpleague%2Fcommonmark-ext-autolink/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thephpleague","download_url":"https://codeload.github.com/thephpleague/commonmark-ext-autolink/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thephpleague%2Fcommonmark-ext-autolink/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264406071,"owners_count":23603059,"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","commonmark","commonmark-extension","gfm","github-flavored-markdown","markdown","php"],"created_at":"2024-08-04T09:02:40.738Z","updated_at":"2025-07-09T06:31:26.683Z","avatar_url":"https://github.com/thephpleague.png","language":"PHP","funding_links":["https://github.com/sponsors/colinodell","https://patreon.com/colinodell"],"categories":["PHP"],"sub_categories":[],"readme":"# URL and email autolinking extension for `league/commonmark`\n\n[![Latest Version on Packagist][ico-version]][link-packagist]\n[![Software License][ico-license]](LICENSE.md)\n[![Build Status][ico-travis]][link-travis]\n[![Coverage Status][ico-scrutinizer]][link-scrutinizer]\n[![Quality Score][ico-code-quality]][link-code-quality]\n[![Total Downloads][ico-downloads]][link-downloads]\n\n## DEPRECATED\n\n**This extension has been deprecated**.  All of its functionality now exists in [`league/commonmark`][link-league-commonmark] 1.3+ under the `League\\CommonMark\\Extension\\Autolink` namespace, so you should upgrade to that version and use that bundled extension instead of this one.\n\n## Overview\n\nThis extension adds [GFM-style autolinking][link-gfm-spec-autolinking] to the [`league/commonmark` Markdown parser for PHP][link-league-commonmark].  It automatically link URLs and email addresses even when the CommonMark `\u003c...\u003e` autolink syntax is not used.\n\nIt also provides a parser to autolink `@mentions` to Twitter, Github, or any custom service you wish, though this is disabled by default.\n\n## Install\n\nVia Composer\n\n``` bash\n$ composer require league/commonmark-ext-autolink\n```\n\n## Usage\n\nConfigure your `Environment` as usual and simply add the `AutolinkExtension` provided by this package:\n\n```php\nuse League\\CommonMark\\CommonMarkConverter;\nuse League\\CommonMark\\Environment;\nuse League\\CommonMark\\Ext\\Autolink\\AutolinkExtension;\n\n// Obtain a pre-configured Environment with all the CommonMark parsers/renderers ready-to-go\n$environment = Environment::createCommonMarkEnvironment();\n\n// Add this extension\n$environment-\u003eaddExtension(new AutolinkExtension());\n\n// Instantiate the converter engine and start converting some Markdown!\n$converter = new CommonMarkConverter([], $environment);\necho $converter-\u003econvertToHtml('I successfully installed the https://github.com/thephpleague/commonmark-ext-autolink extension!');\n```\n\n## `@mention` Autolinking\n\nThis extension also provides functionality to automatically link \"mentions\" like `@colinodell` to Twitter, Github, or any other site of your choice!\n\nFor Twitter:\n\n```php\nuse League\\CommonMark\\Environment;\nuse League\\CommonMark\\Ext\\Autolink\\InlineMentionParser;\n\n$environment = Environment::createCommonMarkEnvironment();\n$environment-\u003eaddInlineParser(InlineMentionParser::createTwitterHandleParser());\n\n// TODO: Instantiate your converter and convert some Markdown\n```\n\nFor GitHub:\n\n```php\nuse League\\CommonMark\\Environment;\nuse League\\CommonMark\\Ext\\Autolink\\InlineMentionParser;\n\n$environment = Environment::createCommonMarkEnvironment();\n$environment-\u003eaddInlineParser(InlineMentionParser::createGithubHandleParser());\n\n// TODO: Instantiate your converter and convert some Markdown\n```\n\nOr configure your own custom one:\n\n```php\nuse League\\CommonMark\\Environment;\nuse League\\CommonMark\\Ext\\Autolink\\InlineMentionParser;\n\n$environment = Environment::createCommonMarkEnvironment();\n$environment-\u003eaddInlineParser(new InlineMentionParser('https://www.example.com/users/%s/profile'));\n\n// TODO: Instantiate your converter and convert some Markdown\n```\n\nWhen creating your own, you can provide two parameters to the constructor:\n\n - A URL template where `%s` is replaced with the username (required)\n - A regular expression to parse and validate the username (optional - defaults to `'/^[A-Za-z0-9_]+(?!\\w)/'`)\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.\n\n## Testing\n\n``` bash\n$ composer test\n```\n\n## Security\n\nIf you discover any security related issues, please email colinodell@gmail.com instead of using the issue tracker.\n\n## Credits\n\n- [Colin O'Dell][link-author]\n- [All Contributors][link-contributors]\n\n## License\n\nThis library is licensed under the BSD-3 license.  See the [License File](LICENSE) for more information.\n\n[ico-version]: https://img.shields.io/packagist/v/league/commonmark-ext-autolink.svg?style=flat-square\n[ico-license]: http://img.shields.io/badge/License-BSD--3-brightgreen.svg?style=flat-square\n[ico-travis]: https://img.shields.io/travis/thephpleague/commonmark-ext-autolink/master.svg?style=flat-square\n[ico-scrutinizer]: https://img.shields.io/scrutinizer/coverage/g/thephpleague/commonmark-ext-autolink.svg?style=flat-square\n[ico-code-quality]: https://img.shields.io/scrutinizer/g/thephpleague/commonmark-ext-autolink.svg?style=flat-square\n[ico-downloads]: https://img.shields.io/packagist/dt/league/commonmark-ext-autolink.svg?style=flat-square\n\n[link-packagist]: https://packagist.org/packages/league/commonmark-ext-autolink\n[link-travis]: https://travis-ci.org/thephpleague/commonmark-ext-autolink\n[link-scrutinizer]: https://scrutinizer-ci.com/g/thephpleague/commonmark-ext-autolink/code-structure\n[link-code-quality]: https://scrutinizer-ci.com/g/thephpleague/commonmark-ext-autolink\n[link-downloads]: https://packagist.org/packages/league/commonmark-ext-autolink\n[link-author]: https://github.com/colinodell\n[link-contributors]: ../../contributors\n[link-league-commonmark]: https://github.com/thephpleague/commonmark\n[link-gfm-spec-autolinking]: https://github.github.com/gfm/#autolinks-extension-\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthephpleague%2Fcommonmark-ext-autolink","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthephpleague%2Fcommonmark-ext-autolink","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthephpleague%2Fcommonmark-ext-autolink/lists"}