fix(navigation): support anchor fragments in note links
Links like `path/to/note.md#heading` previously errored with "Note not found" because the full href (including `#hash`) was matched against file paths. Split the fragment off in the link handler, plumb it through the event bus, and scroll the matching heading into view once the target note is in place. Headings now get GitHub-style ids via markdown-it-anchor + github-slugger so the anchors actually exist. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -30,8 +30,13 @@ export const useLinks = (
|
||||
return
|
||||
}
|
||||
|
||||
const hashIndex = href.indexOf("#")
|
||||
const path = hashIndex === -1 ? href : href.slice(0, hashIndex)
|
||||
const hash = hashIndex === -1 ? undefined : href.slice(hashIndex + 1)
|
||||
|
||||
noteEventBus.emit({
|
||||
path: href,
|
||||
path,
|
||||
hash,
|
||||
currentNoteSHA: toValue(sha),
|
||||
user: store.user,
|
||||
repo: store.repo
|
||||
|
||||
Reference in New Issue
Block a user