Feat v0.4.3 backlinks wikilinks (#25)
All checks were successful
CI/CD / detect-changes (push) Successful in 3s
CI/CD / test-frontend (push) Successful in 4s
CI/CD / test-go-pg (push) Successful in 2m41s
CI/CD / test-sqlite (push) Successful in 2m43s
CI/CD / build-and-deploy (push) Successful in 25s

Co-authored-by: Jeffrey Smith <jasafpro@gmail.com>
Co-committed-by: Jeffrey Smith <jasafpro@gmail.com>
This commit was merged in pull request #25.
This commit is contained in:
2026-03-29 17:05:44 +00:00
committed by xcaliber
parent 32beb3cee4
commit 31ab572c95
7 changed files with 391 additions and 16 deletions

View File

@@ -2,6 +2,47 @@
All notable changes to Switchboard Core are documented here.
## v0.4.3 — Backlinks + Wikilinks
### Added
- **Links table** (`ext_notes_links`): source_id, target_id, link_text columns
with indexes on source_id and target_id for bidirectional lookup.
- **Wikilink extraction**: `_extract_wikilinks()` parses `[[...]]` patterns
using `split("[[")` + `find("]]")` (Starlark has no regex or while loops).
Returns deduplicated list of link text strings.
- **Link sync on save**: `_sync_links()` called from `_create_note` and
`_update_note` when body changes. Follows the tags delete-all + reinsert
pattern. Resolves link text to note IDs via case-insensitive title matching.
Unresolved links stored with empty `target_id`.
- **Cascade delete**: Hard-deleting a note removes both outgoing links
(source_id matches) and incoming backlinks (target_id matches).
- **Link API endpoints**: `GET /links/:note_id` returns outgoing links.
`GET /backlinks/:note_id` returns incoming links enriched with source note
titles to avoid extra frontend round-trips.
- **Wikilink preview rendering**: `[[Note Title]]` syntax renders as clickable
accent-colored links in the markdown preview. Unresolved wikilinks styled
in danger/red with dashed underline.
- **Wikilink click navigation**: Clicking a resolved wikilink navigates to the
target note. Clicking an unresolved wikilink creates the note and navigates
to it, then re-saves the source note so the link resolves to blue.
- **Backlinks panel**: Collapsible panel below the editor showing all notes
that link to the current note. Each backlink displays source title and link
text. Click to navigate. Hidden when no backlinks exist.
- **Updated stats**: `/stats` response now includes `links` count.
### Data model
| Table | Columns |
|-------|---------|
| `ext_notes_links` | source_id, target_id, link_text |
### Notes package version
0.3.0 → 0.4.0
---
## v0.4.2 — Tags + Search
### Added