Skip to content

Add a "Linked from" backlinks row to open notes - #1

Open
AllTerrainDeveloper wants to merge 1 commit into
WordPress:mainfrom
AllTerrainDeveloper:add-backlinks
Open

Add a "Linked from" backlinks row to open notes#1
AllTerrainDeveloper wants to merge 1 commit into
WordPress:mainfrom
AllTerrainDeveloper:add-backlinks

Conversation

@AllTerrainDeveloper

@AllTerrainDeveloper AllTerrainDeveloper commented Aug 25, 2026

Copy link
Copy Markdown

What this does

image

Notes can already link forward with [[label|note-id]], but there is no way to see which notes point at the one you are reading. This adds a Linked from row at the bottom of every open note, listing the notes that link to it, newest first. Each entry is clickable and opens the linking note.

How it works

  • A scanner extracts wiki-link targets from note bodies using the same parsing rules as the renderer, so links inside fenced code blocks or inline backticks do not count.
  • Targets resolve through resolveNote(), exactly like link clicks, so both [[title]] and [[label|note-id]] forms work and dead links are ignored.
  • A note never lists itself.
  • The row is bounded at 20 entries, with an "and N more" summary, matching the app's bounded-rendering approach.
  • The index is rebuilt on each story render — no cache to invalidate, so it is always correct after saves and deletes.

Tests

  • New Chrome scenario: creates a note with a real link, a code-quoted link, a dead link, and a self-link, then asserts the target shows exactly one backlink and that clicking it opens the source note.
  • Static source check for Chrome-less runs.
  • Full suite green: PIPLET_REQUIRE_CHROME=1 php tests/run.php → 433 assertions, plus the unsafe suite.

🤖 Generated with Claude Code

Each rendered note now lists the notes whose bodies wiki-link to it,
newest first. Target resolution matches link-click behavior (id or
title), links inside fenced or inline code do not count, a note never
lists itself, and the row is bounded at 20 entries with a summary for
the rest. Covered by a Chrome scenario and a static source check.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ugoy2ZABg1zSBPszPmBaww
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