{"id":15787339,"url":"https://github.com/tomtung/vscode-markdown-linkify","last_synced_at":"2026-04-11T08:04:37.382Z","repository":{"id":142161732,"uuid":"503214891","full_name":"tomtung/vscode-markdown-linkify","owner":"tomtung","description":"Customize linkification for Markdown preview in VS Code.","archived":false,"fork":false,"pushed_at":"2022-07-26T09:30:20.000Z","size":160,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-05T21:07:40.202Z","etag":null,"topics":["linkify-it","markdown","markdown-previewer","vscode","vscode-extension"],"latest_commit_sha":null,"homepage":"https://marketplace.visualstudio.com/items?itemName=tomtung.vscode-markdown-linkify","language":"TypeScript","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/tomtung.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","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":"2022-06-14T05:02:24.000Z","updated_at":"2022-08-04T17:27:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"b9b18859-8e1d-4175-b02d-d7b284e48272","html_url":"https://github.com/tomtung/vscode-markdown-linkify","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomtung%2Fvscode-markdown-linkify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomtung%2Fvscode-markdown-linkify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomtung%2Fvscode-markdown-linkify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomtung%2Fvscode-markdown-linkify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tomtung","download_url":"https://codeload.github.com/tomtung/vscode-markdown-linkify/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246512993,"owners_count":20789811,"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-it","markdown","markdown-previewer","vscode","vscode-extension"],"created_at":"2024-10-04T21:07:46.759Z","updated_at":"2026-04-11T08:04:37.355Z","avatar_url":"https://github.com/tomtung.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# VS Code: Custom Linkification in Markdown Preview\n\n![](docs/demo.png)\n\nThis extension customizes automatic linkification of texts rendered in Markdown Preview.\n\n## Extension Settings\n\nBy adding rules to the `\"markdown-linkify.rules\"` settings, the user can specify how links with custom formats are matched, linked, and rendered.\n\nThe value of `\"markdown-linkify.rules\"` is a list of custom linkification rules, each represented by a JSON object with 4 members:\n```typescript\ninterface Rule {\n    prefix: string\n    tail?: string\n    url?: string\n    text?: string\n}\n```\n- `prefix`: the prefix of link strings to be matched, most typically a protocol name that ends with `:` (like `skype:`). The match is automatically ensured to not be preceded by an alphanumeric character.\n- `tail`: an optional regex for matching the **remainder** of the link string immediately following the prefix. The match is automatically ensured to be immediately followed by either space or punctuation. *If not provided, defaults to matching URI-path-like strings.*\n- `url`: an optional string template for the rendered link's URL. *If not provided, defaults to the matched link string, possibly prepended by `http://`.*\n- `text`: an optional string template for the rendered link text. *If not provided, defaults to the matched link string.*\n\nBoth template strings can contain placeholders of matched (sub)strings (`%MATCH%`, `%PREFIX%`, and `%TAIL%`) and backreferences (`$1`, `$2`, ...) to capturing groups from the `tail` regex. The placeholder `%MATCH%` is replaced with the entirety of the matched link string, while `%PREFIX%` only the prefix part, `%TAIL%` only the tail part.\n\n## Examples\n\nThe custom linkification demonstrated in the screenshot above is enabled by the following setting:\n\n```json\n{\n    \"markdown-linkify.rules\": [\n        { \"prefix\": \"skype:\" },\n        { \"prefix\": \"goto/\" },\n        {\n            \"prefix\": \"@\",\n            \"tail\": \"([a-zA-Z0-9_]){1,15}(?!_)\",\n            \"url\": \"https://twitter.com/%TAIL%\"\n        },\n        {\n\t\t\t\"prefix\": \"gh-issue:\",\n\t\t\t\"tail\": \"([a-zA-Z\\\\d](?:[a-zA-Z\\\\d]|-(?=[a-zA-Z\\\\d]))+)\\/([a-zA-Z.\\\\-_]+)(?:#(\\\\d+))\",\n\t\t\t\"url\": \"https://github.com/$1/$2/issues/$3\",\n\t\t\t\"text\": \"%TAIL%\"\n\t\t}\n    ]\n}\n```\n\nLet's break it down in the following sections.\n\n### Custom URI Scheme\n\nWith the first simple rule:\n\n```json\n{ \"prefix\": \"skype:\" }\n```\n\nthe text\n\n```\nDo you still use Skype? Call me at: skype:echo123?call.\n```\n\nis rendered to\n\n\u003e \u003cp\u003eDo you still use Skype? Call me at: \u003ca href=\"skype:echo123?call\"\u003eskype:echo123?call\u003c/a\u003e.\u003c/p\u003e\n\n### Non-URI Link Prefix\n\nSimilarly, with the rule:\n\n```json\n{ \"prefix\": \"goto/\" }\n```\n\nthe text\n\n```\nHere's an internal short link: goto/link.\nIt may get quite complex (goto/abc/1;2,3?x=4\u0026y=5)!\n```\n\nis rendered to\n\n\u003e \u003cp\u003eHere's an internal short link: \u003ca href=\"http://goto/link\"\u003egoto/link\u003c/a\u003e. It may get quite complex (\u003ca href=\"http://goto/abc/1;2,3?x=4\u0026amp;y=5\"\u003egoto/abc/1;2,3?x=4\u0026amp;y=5\u003c/a\u003e)!\u003c/p\u003e\n\nHere since `goto/` doesn't look like a valid URI prefix, `http://` is automatically prepended to the link URL by default.\n\n### Matching with Regex, Linking with Template\nThe next rule matches Twitter handles using regex, and constructs link URLs using a template string.\n```json\n{\n    \"prefix\": \"@\",\n    \"tail\": \"([a-zA-Z0-9_]){1,15}(?!_)\",\n    \"url\": \"https://twitter.com/%TAIL%\"\n}\n```\n\nWith this rule, the text\n\n```\nThis is a Twitter handle @jack.\nNot to be confused with an Email address jack@twitter.com.\n```\n\nis rendered to\n\u003e \u003cp\u003eThis is a Twitter handle \u003ca href=\"https://twitter.com/jack\"\u003e@jack\u003c/a\u003e. Not to be confused with an Email address \u003ca href=\"mailto:jack@twitter.com\"\u003ejack@twitter.com\u003c/a\u003e.\u003c/p\u003e\n\n### Overriding Link Text\n\nThe final rule demonstrates a more advanced use case: in addition to matching the tail with a regex and constructing the link URL with backreferences to capturing groups in the regex, it also drops the prefix string when rendering the link text.\n\n```json\n{\n    \"prefix\": \"gh-issue:\",\n    \"tail\": \"([a-zA-Z\\\\d](?:[a-zA-Z\\\\d]|-(?=[a-zA-Z\\\\d]))+)\\/([a-zA-Z.\\\\-_]+)(?:#(\\\\d+))\",\n    \"url\": \"https://github.com/$1/$2/issues/$3\",\n    \"text\": \"%TAIL%\"\n}\n```\n\nWith this rule, the following text:\n\n```\nI invented this custom link format for GitHub issues:\ngh-issue:tomtung/vscode-markdown-linkify#123.\n```\n\nis rendered to\n\n\u003e \u003cp\u003eI invented this custom link format for GitHub issues: \u003ca href=\"https://github.com/tomtung/vscode-markdown-linkify/issues/123\"\u003etomtung/vscode-markdown-linkify#123\u003c/a\u003e.\u003c/p\u003e\n\n## Contributing\n\nSee [`CONTRIBUTING.md`](CONTRIBUTING.md) for details.\n\n## License\n\nApache 2.0; see [`LICENSE.txt`](LICENSE.txt) for details.\n\n## Disclaimer\n\nThis project is not an official Google project. It is not supported by Google and Google specifically disclaims all warranties as to its quality, merchantability, or fitness for a particular purpose.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomtung%2Fvscode-markdown-linkify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomtung%2Fvscode-markdown-linkify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomtung%2Fvscode-markdown-linkify/lists"}