Skip to content

Fix link parsing and graph refresh bugs#57

Open
natefrisch01 wants to merge 1 commit into
masterfrom
further-bug-fixes
Open

Fix link parsing and graph refresh bugs#57
natefrisch01 wants to merge 1 commit into
masterfrom
further-bug-fixes

Conversation

@natefrisch01
Copy link
Copy Markdown
Owner

@natefrisch01 natefrisch01 commented May 16, 2026

Bug Fix Summary

This change addresses the open bug reports related to link parsing, metadata handling, stale paths, startup timing, and broken-link behavior.

Addressed Issues

What Changed

  • Improved link matching so typed edges now support:
    • Wikilinks such as [[Target]]
    • Markdown links such as [Target](Target.md)
    • URL-encoded Markdown links such as [Ludwig](Ludwig%20Wittgenstein.md)
    • Links with or without .md
    • Heading links such as [[Target#Heading]]
    • Block links such as [[Target#^block-id]]
    • Display aliases such as [[Target|Alias]]
    • Quoted property values
    • List-valued properties
    • Multiple links stored under the same property key
  • Reworked metadata matching to resolve links through Obsidian's metadata cache instead of comparing raw paths only.
  • Added better refresh behavior when:
    • Dataview becomes available after this plugin loads
    • Obsidian resolves links
    • Files are renamed or moved
  • Prevented unresolved/broken graph edges from crashing typed-link cleanup.
  • Initialized theme text color immediately so labels are visible on first render.
  • Fixed legend usage counting for repeated link types.

Manual Test Plan

1. Build and Reload

  • Run the normal plugin build process.
  • Reload Obsidian after the compiled main.js is updated.

2. Create Test Notes

Create these target notes:

Target One.md

# Target One

## Heading

Paragraph text ^block-id

Target Two.md

# Target Two

Ludwig Wittgenstein.md

# Ludwig Wittgenstein

3. Test Multiple Links in One Property

Create a source note with:

---
related:
  - "[[Target One]]"
  - "[[Target Two]]"
---

Expected result:

  • Graph view shows a typed edge from the source note to both targets.
  • Both edges are labeled related.

4. Test Markdown Links With Spaces

Create a source note with:

reference:: [Ludwig](Ludwig%20Wittgenstein.md)

Expected result:

  • Graph view shows a typed edge to Ludwig Wittgenstein.
  • The edge label is reference.

5. Test Heading, Block, and Alias Links

Create a source note with:

section_ref:: [[Target One#Heading|Shown name]]
block_ref:: [[Target One#^block-id]]

Expected result:

  • Both typed edges resolve to Target One.
  • Labels render as section_ref and block_ref.

6. Test Broken Links

Create a source note with:

valid:: [[Target Two]]
broken:: [[Does Not Exist Yet]]

Expected result:

  • The valid typed edge still renders.
  • The unresolved/broken link does not prevent other labels from appearing.

7. Test Moved Files

  • Create a typed edge to Target Two.
  • Move Target Two.md into another folder while the graph is open.
  • If desired, disable Obsidian's automatic internal-link updates before moving it to exercise the stale-path case more directly.

Expected result:

  • After Obsidian refreshes metadata, the typed edge label comes back correctly for the moved file.

8. Test Dataview Load Order

  • Disable both Dataview and Graph Link Types.
  • Reload Obsidian.
  • Enable Graph Link Types first.
  • Open graph view.
  • Enable Dataview afterward.

Expected result:

  • Typed-link labels appear without needing to close and reopen the graph.

9. Test First-Render Visibility

  • Start Obsidian in dark mode.
  • Open graph view immediately after reload.

Expected result:

  • Typed-link labels are visible immediately without toggling themes first.

Notes

  • This patch improves handling for supported Obsidian internal-link formats.
  • Filenames using characters that Obsidian itself treats as invalid for links are still limited by Obsidian's own link rules rather than this plugin.

Final note

This entire commit was written by AI and tested by me. I'm reluctant to merge changes that I didn't make myself, but the testing it suggested I do yielded results I am quite impressed with. I am going to leave this as a merge request for now.

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