Skip to content

Fix(tui): gd follows links the way the desktop does - #33

Merged
adibhanna merged 1 commit into
claude/fix-autosave-undo-gd-b13126from
claude/heuristic-goldstine-e4ca3a
Nov 3, 2026
Merged

adibhanna merged 1 commit into
claude/fix-autosave-undo-gd-b13126from
claude/heuristic-goldstine-e4ca3a

Conversation

@adibhanna

Copy link
Copy Markdown
Contributor

Brings the rest of gd link following in line with the desktop app, whose source is the spec. Stacked on #32, which adds vault.ResolveNoteHref. Merge that first; this PR's diff shows only the link work.

What changes

  • Destinations with spaces. [a](<./My Note>) was "No link under the cursor". The editor now reads links like the desktop's LINK_SHAPES: spaces with or without angle brackets, a ) inside angle brackets, and "title" or 'title' dropped. Reading mode stays stricter, as the desktop's renderer is: spaces need angle brackets to count as a link.
  • Dead links. A dead relative link was "Note not found". It now asks Create note "Work/My Note"? and creates the note on yes. Hrefs that name a file, climb out of the vault, use another scheme or hold characters a note name cannot have still say "Not a note".
  • Anchors. #heading (text, percent-encoded or slug), ^block and #^block now land on their target with it at the top of the view, on Markdown links and wikilinks, in the editor and in reading mode. A missing anchor opens the note where it was. [a](#Heading), [[#Heading]] and [[^id]] jump inside the note; the wikilink forms used to offer a note with an empty name.
  • Bare domains. [site](google.com) opens https://google.com, a port of externalLinkUrl. As on the desktop, Note.md and photo.png stay local, and so a bare [a](v1.2) goes to the browser even if a note has that name, while ./v1.2 stays a note.

Where this differs from the desktop on purpose

  • Where a dead link's note goes. It is created where the link points, so the link resolves afterwards. The desktop suggests /./My Note.md for ./My Note, which its own parseCreateNotePath rejects, and it puts a bare name in the Inbox. A path from the vault root (/Top/New) starts at the Inbox, as on the desktop.
  • It asks yes or no. The desktop opens an editable path prompt. This uses a.confirm, like the existing wikilink branch.
  • Lookup order. Markdown links try the path relative to the note first, then the note name. That is the desktop's click path (followLinkTarget) and what zn v0.15.0: undo cannot wipe a note, autosave can be off, gd follows links like the desktop #32 chose; the desktop's gd tries the name first, so the two can differ when a note elsewhere has the same title.

Changes to code from #32

  • TestFollowLinkReportsLinksItCannotOpen loses its "missing note" case, since that message is gone. TestDeadRelativeLinkOffersTheNote covers the new behavior.
  • NoteHrefPath is extracted from ResolveNoteHref, with no change in behavior, so the create offer can use it.

Not in this PR

Still different from the desktop: vault attachments and files outside the vault from a Markdown link, gating of application schemes (any :// link goes to the system opener with no question), periodic notes from a dead link, [[https://…]], and .base databases.

Testing

Markdown links with spaces in the destination are recognized, with or
without angle brackets, and titles are dropped from the target.

A dead link offers to create the note where it points, so the link
resolves once the note exists. Hrefs that name a file or leave the vault
still report "Not a note".

A #heading or ^block anchor now lands on its target, on Markdown links
and wikilinks alike, in the editor and in reading mode. Same-note anchors
jump instead of offering a note with an empty name.

Bare domains such as google.com open in the browser.
@adibhanna
adibhanna merged commit 03f633d into claude/fix-autosave-undo-gd-b13126 Nov 3, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant