Links: one targetTitle for the links list and the reviewer

src/ui/linker.ts titleOf and server/links/review.ts targetTitle named a
target the same way (a node's label, else its path or "a note"; an
article's title; a page's title or address). It lives in
src/core/links.ts beside the other helpers on targets.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014yB6q4BHMwptTX3YFtkRab
This commit is contained in:
thalladaandClaude Opus 5.5 committed 2026-11-17 16:26:32 -05:00
1 parent dbbe3effac
commit e6d71e84de
3 files changed
+11 -14

No files matched your search

+1 -4
View File
@@ -11,9 +11,8 @@
* and the report says why. Only phrases and titles ever go to Wikipedia; the text goes only to the
* model, as it does when the model writes.
*/
import { ownerSection } from "../../src/core/links";
import { ownerSection, targetTitle } from "../../src/core/links";
import { ancestors, descendants, label, notesOf, sections, topOf, tops, type NodeId, type Snap } from "../../src/core/model";
import type { Ref } from "../../src/core/ref";
import { clip, plain, sentences } from "../../src/core/text";
import type { LinkVerdicts, LLM } from "../../src/llm/types";
import type { WikiClient } from "../wiki";
@@ -118,8 +117,6 @@ const linkedTitles = (snap: Snap, id: NodeId): string[] =>
return r ? [targetTitle(snap, r)] : [];
});
const targetTitle = (snap: Snap, r: Ref) => (r.kind === "wiki" ? r.title : r.kind === "url" ? (r.title ?? r.url) : r.id && snap.nodes[r.id] ? label(snap, r.id) : (r.path ?? []).join(" › ") || "a note");
/** Everything already linked under a top, in reading order, each title once. */
function linkedInTop(snap: Snap, top: NodeId): string[] {
const out = new Set<string>();