{"id":19638948,"url":"https://github.com/savetheclocktower/tree-sitter-hyperlink","last_synced_at":"2026-06-10T18:31:38.575Z","repository":{"id":152473485,"uuid":"616709812","full_name":"savetheclocktower/tree-sitter-hyperlink","owner":"savetheclocktower","description":"Tree-sitter grammar for detecting URLs in arbitrary text","archived":false,"fork":false,"pushed_at":"2024-10-21T00:38:39.000Z","size":51,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-06-09T13:34:13.889Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/savetheclocktower.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-20T23:25:29.000Z","updated_at":"2024-10-21T00:38:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"5e2210d0-c1a9-46b6-8814-3feff963e5ff","html_url":"https://github.com/savetheclocktower/tree-sitter-hyperlink","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/savetheclocktower/tree-sitter-hyperlink","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/savetheclocktower%2Ftree-sitter-hyperlink","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/savetheclocktower%2Ftree-sitter-hyperlink/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/savetheclocktower%2Ftree-sitter-hyperlink/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/savetheclocktower%2Ftree-sitter-hyperlink/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/savetheclocktower","download_url":"https://codeload.github.com/savetheclocktower/tree-sitter-hyperlink/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/savetheclocktower%2Ftree-sitter-hyperlink/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34165482,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-10T02:00:07.152Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-11-11T12:43:15.665Z","updated_at":"2026-06-10T18:31:38.551Z","avatar_url":"https://github.com/savetheclocktower.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tree-sitter-hyperlink\n\n[Tree-sitter](https://github.com/tree-sitter/tree-sitter) grammar for detecting URLs in prose.\n\nEventually designed to do all the things [TextMate’s hyperlink helper bundle](https://github.com/textmate/hyperlink-helper.tmbundle/blob/master/Syntaxes/Hyperlink.tmLanguage) can do. That bundle got converted to Atom as [language-hyperlink](https://github.com/pulsar-edit/language-hyperlink/), but a tree-sitter version needs to exist for injecting into tree-sitter grammars in [Pulsar](https://pulsar-edit.dev/).\n\n\n## Syntax\n\nSupport is currently limited to URLs that\n\n* begin with `http` or `https`,\n* have sections of ordinary text with dots/slashes in between, and\n* do not end with any of `,.\"']`, all of which are far more likely to be meant\n  as a prose delimiter rather than part of the URL.\n\nURLs that end in `)` will have that `)` included in the URL _if_ it was preceded by an earlier `(` in the URL; otherwise it’ll be treated as a delimiter like the characters listed above.\n\nValidity of the URL, or of any TLDs, is _far_ beyond the ambitions of this parser.\n\n## Examples\n\nURLs that will be correctly identified and highlighted:\n\n```\nhttp://example.com/foo?bar=baz\n\nYou might find my web site at https://example.com. The period at the end of the last sentence is not part of the URL.\n\nOne example would be [this one](http://example.com/foo?bar=baz), like in Markdown.\n\nOr this one [http://example.com]\n\nThis fragment will be ignored http://\nAs will this one https://bleh\n\nCSS URL without quotes:\n@import url(https://www.example.com/style.css);\n\nCSS URL with quotes:\ndiv {\n  background-image: url(\"https://www.example.com/style.gif\");\n}\n\nalso https://example.net.\n\nGood news, Elvis: https://en.wikipedia.org/wiki/Alison_(song) (because the closing parenthesis is mistakenly assumed not to be part of the URL)\n\n\u003ca href=\"http://example.com\"\u003ehttp://example.com\u003c/a\u003e (it'll recognize both instances)\n\n[A link to the Elvis Costello song in question](https://en.wikipedia.org/wiki/Alison_(song)) will correctly interpret the first ) as being part of the URL, but _not_ the second one.\n\n```\n\nThere are surely some URLs out there in the wild that run afoul of these rules, so open an issue if you like.\n\n## Tests\n\nWhat I need to be able to test this properly is to inspect _the exact boundaries_ of a match, and [neither](https://tree-sitter.github.io/tree-sitter/creating-parsers#command-test) [kind](https://tree-sitter.github.io/tree-sitter/syntax-highlighting#unit-testing) of tree-sitter test does exactly what I need it to.\n\nUntil I get around to something more rigorous: if you’re contributing a change and want to guard against regressions, compare the output of `tree-sitter parse examples/example.txt` with the contents of `example_tree.txt`.\n\n## TODO\n\n* Fix the issue with parens in URLs — ideally by allowing one `)` for each `(` encountered in a URL, and the same with `[]`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsavetheclocktower%2Ftree-sitter-hyperlink","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsavetheclocktower%2Ftree-sitter-hyperlink","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsavetheclocktower%2Ftree-sitter-hyperlink/lists"}