Feature/wiki links indexer#1123
Merged
Merged
Conversation
…ndexer Adds extraction of [[Title]] and [[Title|Alias]] patterns from page content, resolved via title-based lookup. [[Folder/Title]] syntax is treated as a path hint and resolved via the existing route-path lookup. Single matches are stored as resolved outgoing links; ambiguous or missing titles are stored as broken.
…ture
B1: Replace [[target]] sentinel format with "wikilink:<target>" so broken
wiki-link records are distinguishable from normal paths and can be
found by the healing infrastructure.
B2: Fall back to title-based lookup when a slash-containing target fails
the path lookup, so [[C/C++]] and similar titles are not always broken.
B3: Add HealWikiLinksForTitle to LinksStore, HealWikiLinksForPage to
LinkService, and wire both into LinkIndexSideEffect.updateAndHeal.
When a page is created or restored, broken [[Title]] sentinels that
match its title are healed automatically.
B4: Strip the "wikilink:" prefix in toOutgoingResultItem so the API
returns [[Title]] in the to_path field instead of the raw sentinel.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends LeafWiki’s link indexing/healing pipeline to understand [[Title]] / [[Title|Alias]] wiki-link syntax, persist unresolved wiki-links via a sentinel to_path, and attempt to heal those links automatically after relevant page mutations.
Changes:
- Add wiki-link parsing and resolution (
[[...]]) alongside existing Markdown link indexing. - Introduce a
wikilink:sentinel scheme for broken wiki-links plus a store/service heal path for those sentinels. - Add unit tests covering wiki-link extraction, resolution, and post-creation healing.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/wiki/pagesave/link_effect.go | Triggers wiki-link healing after page mutations. |
| internal/links/links_store.go | Adds DB healing method for wiki-link sentinel records. |
| internal/links/link_service.go | Routes indexing through combined Markdown + wiki-link target collection; exposes wiki-link heal method. |
| internal/links/link_service_test.go | Adds tests for extraction/resolution and healing behavior. |
| internal/links/helpers.go | Implements [[...]] parsing, sentinel helpers, and wiki-link target resolution; improves outgoing display for sentinels. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
HealWikiLinksForPage was only called on Create/Restore. After renaming a page (title change), broken [[NewTitle]] sentinels in other pages were never healed. Calling it after every Update ensures that renaming a page to a title that was previously broken as a wiki-link resolves correctly.
1. Move HealWikiLinksForPage into healExact so it runs consistently for all code paths (Create/Restore/Move/Update), removing the separately placed call and the duplication in updateAndHeal. 2. Use COLLATE NOCASE in HealWikiLinksForTitle so that a broken [[target page]] sentinel is healed when the page is created as "Target Page", matching the case-insensitive behaviour of FindPagesByTitle. 3. Skip wikilink sentinel paths in rewriteResolvedTargets to prevent them being normalised as route paths (e.g. /wikilink:Title) during rename/move refactors, which would make them permanently unresolvable. 4. Store broken path-hint targets as normal route paths instead of sentinels so HealLinksForExactPath can heal them when the target page is later created at that path.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.