Skip to content

fix reading view tags and same-note heading links rendered as task links - #2398

Open
enieuwy wants to merge 1 commit into
callumalpass:mainfrom
enieuwy:fix/2397-reading-view-hash-links
Open

enieuwy wants to merge 1 commit into
callumalpass:mainfrom
enieuwy:fix/2397-reading-view-hash-links

Conversation

@enieuwy

@enieuwy enieuwy commented Oct 13, 2026

Copy link
Copy Markdown

Summary

Fixes #2397

In Reading View, when the current note is a task, tags (#servers/db) and same-note heading links ([[#Installation]]) were replaced by the task widget for the current note (for example MariaDB > Installation (Scheduled Aug 20)).

Cause: these anchors have a target that starts with #, so the link path is empty. getFirstLinkpathDest("", sourcePath) resolves an empty path to the current note. That note is a task, so ReadingModeTaskLinkProcessor replaced the anchor.

Fix: the Reading View post processor now skips a.tag anchors and links whose target starts with #. Links to another task with a heading ([[Other task#Heading]]) have a non-empty path and still render as before.

Live Preview is not affected: parseWikilinkSync and parseMarkdownLinkSync in TaskLinkOverlay.ts already reject links with an empty path, and tags are not wikilinks.

Changes

  • src/editor/ReadingModeTaskLinkProcessor.ts: skip tag and same-note fragment links.
  • tests/unit/editor/ReadingModeTaskLinkProcessor.fragmentLinks.test.ts: regression tests.
  • docs/releases/unreleased.md: release note, thanks to @hm-24.

How tested

  • npx jest tests/unit/editor/ReadingModeTaskLinkProcessor.fragmentLinks.test.ts: 4 tests. All 4 fail without the fix and pass with it.
  • The existing reading-mode tests (issue-1639-alias-overlay-reading-mode, issue-1350-reading-mode-inline-refresh, issue-2072-heading-task-link-display, TaskLinkWidget.navigation) still pass.
  • ESLint is clean on the changed source file.
  • Not tested in a live Obsidian vault.

Implemented with AI assistance (Claude, via the oh-my-pi agent harness).

This branch has not been deployed

No deployments
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.

[Bug]: Tags and same-note heading links are rendered as TaskNotes references in Reading View

1 participant