From 67ea3c1c452ca433ba6cef66539c7ab79360d797 Mon Sep 17 00:00:00 2001 From: "JLDiaz (m)" Date: Sun, 16 Nov 2025 11:29:58 +0100 Subject: [PATCH] feat(overlay): Skip overlay rendering if wikilink uses display text --- src/editor/ReadingModeTaskLinkProcessor.ts | 5 +++++ src/editor/TaskLinkOverlay.ts | 8 ++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/editor/ReadingModeTaskLinkProcessor.ts b/src/editor/ReadingModeTaskLinkProcessor.ts index ef90246d..79ebe327 100644 --- a/src/editor/ReadingModeTaskLinkProcessor.ts +++ b/src/editor/ReadingModeTaskLinkProcessor.ts @@ -170,6 +170,11 @@ export class ReadingModeTaskLinkProcessor { displayText = linkContent; } + if (displayText) { + // If there's a display text (alias), do not replace the link + return; + } + // Create a task widget instance const widget = new TaskLinkWidget(taskInfo, this.plugin, originalText, displayText); diff --git a/src/editor/TaskLinkOverlay.ts b/src/editor/TaskLinkOverlay.ts index 11b8263c..e675d71d 100644 --- a/src/editor/TaskLinkOverlay.ts +++ b/src/editor/TaskLinkOverlay.ts @@ -280,13 +280,17 @@ export function buildTaskLinkDecorations( : parseMarkdownLinkSync(link.match); if (!parsed) continue; - const { linkPath } = parsed; - + const { linkPath, displayText } = parsed; // Validate link path if (!linkPath || typeof linkPath !== "string" || linkPath.trim().length === 0) { continue; } + // Disable overlay if there's a display text (alias) + if (displayText) { + continue; + } + // Resolve the link path const resolvedPath = resolveLinkPathSync(linkPath, currentFile, plugin); if (!resolvedPath) continue;