Documentation
¶
Overview ¶
Package links finds and classifies links in task text. It is the Go counterpart of lib/tasks/links.rb.
Bodies increasingly carry references into other systems (Slack threads, Jira tickets, PRs, docs); this is the one place that knows how to spot a link and name the system it points into, so every surface (`show`, `links`, `open`, the TUI opener) agrees.
Two shapes are recognized, in this order:
[[url][label]] / [[url]] org-mode links, the canonical form for notes https://… bare URLs in prose
Only web URLs count: an org internal link ([[My Heading]], [[id:…]], [[file:…]]) is navigation within org, not a reference into another system, so it is not reported.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Link ¶
Link is one reference found in task text. Label is nil for a bare URL — an absent label and an empty one are different answers, and the JSON says so.
func Extract ¶
Extract returns every web link in `text`, in FILE ORDER (masking preserves string offsets, so the three passes interleave correctly — `open <n>` counts the same way the note reads), de-duplicated by URL.
Dedupe keeps the most useful spelling, not the earliest one: among the occurrences of one URL, the first LABELLED occurrence wins, and only if none is labelled does the first (bare) occurrence stand in. Which spelling survives is therefore independent of where in the text each one sits.
Position still decides ORDER: each surviving link is listed at its URL's FIRST occurrence, whichever spelling that was, so adding a label to a URL already in the text never moves anything in the listing.
`shorthands` (name => URL template with %s, from config `link.<name>` rows) additionally expands compact tokens like `jira:OPS-1234`. `customSystems` (name => host, from config `system.<name>` rows) extends classification for self-hosted instances the built-in registry cannot know.