Repository navigation
Description
What: useLinkify — Finds URLs, email addresses and custom patterns in plain text and returns React nodes with a Link for each match; the links respect LinkProvider for client-side routing.
A good example shows: A short comment thread where each comment is plain text, for example "See https://example.com/spec or email [email protected]". The hook turns the URL and the email into links. A custom pattern turns issue references such as "#123" into links too, which shows the patterns option.
Where:
- Hook source:
packages/core/src/Link/useLinkify.tsx - Hook doc: none yet, so the hook has no docsite page. Create
packages/core/src/Link/useLinkify.doc.mjsnext to the source (seepackages/core/src/hooks/useClipboard.doc.mjsfor the shape andpackages/cli/authoring/doctypes/hook/type.tsfor the type). - Example blocks:
packages/cli/assets/templates/blocks/components/(add a<Name>.tsx+<Name>.doc.mjspair, for example underLink/). Existing hook examples to copy the shape from:Theme/useThemeHookUsageandPopover/PopoverHookUsage.
Acceptance criteria:
-
A template block names
useLinkifyinexampleFor(oralsoExampleFor) and renders in the Examples section of the hook's docsite page. -
The hook visibly drives the behavior: removing the hook call breaks what the example shows. Minimal code; no unrelated UI or styling.
-
Meets the rule
architecture:knowledge-contractsINV28 (docs/architecture/knowledge-contracts.md), quoted here:INV28 — Every public hook has a minimal, runnable example that
demonstrates it. A public hook is a hook that a package's committed API
report lists. Its documentation includes at least one realistic, runnable
example: a live template block that names the hook as its example target
(exampleFor, oralsoExampleForwhen the block also serves another page).
The example:- shows the hook inside a component solving the use case its docs state;
- imports the package's own code only through its public entry points;
- covers the hook's main parameters and return values;
- passes the docs build;
- gets its visible behavior from the hook itself, so removing the hook breaks
what the example shows; and - is minimal: only the code needed to show the use case, with no unrelated UI
or styling.
How a docs page selects and orders its example blocks belongs to
architecture:template-authoring. A public hook without a conforming example
is a docs gap, tracked as an issue in the repository's issue queue (DEC-16). -
A HookDoc for
useLinkifywith usage, params and returns, so the hook gets a docsite page. -
If the example adds a sandbox or docsite route, register it in the route list so the build passes.
Good first issue: start with CONTRIBUTING.md. For orientation, run astryx docs and astryx component --list from the repo root (the CLI is node packages/cli/clients/cli/bin/astryx.mjs). The hook's own tests next to its source show how it is called.
Filed by an AI agent on behalf of the maintainer, as part of a docs-coverage sweep.
Activity
Mittalnew commentedon Nov 3, 2026
Hi! I'd like to work on this. I'm planning to add a useLinkify.doc.mjs page and a small live example with a short comment thread, where URLs and emails become links and a custom pattern turns "#123" references into links too, to show the patterns option. Could you assign it to me?
docs(useLinkify): add hook docs and a comment-thread example block (m…