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;