Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/editor/ReadingModeTaskLinkProcessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,18 @@ export class ReadingModeTaskLinkProcessor {
// Get the original link text for display
const originalText = linkEl.textContent || `[[${originalLinkPath}]]`;

// Check for alias exclusion
if (this.plugin.settings.disableOverlayOnAlias) {
// In reading mode, we check if the displayed text differs from the path or title
// If it does, it's likely an alias/custom text
const currentText = linkEl.textContent || "";

// If text doesn't match path AND doesn't match task title, it's an alias
if (currentText !== originalLinkPath && currentText !== taskInfo.title) {
return;
}
}

// Parse display text if it's a piped link
let displayText: string | undefined;
const linkContent = linkEl.textContent || "";
Expand Down
8 changes: 8 additions & 0 deletions src/editor/TaskLinkOverlay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,14 @@ export function buildTaskLinkDecorations(
continue;
}

// Check for alias exclusion
if (plugin.settings.disableOverlayOnAlias) {
// Skip Wikilinks with pipes [[Path|Alias]]
if (link.type === "wikilink" && link.match.includes("|")) {
continue;
}
}

// Parse the link to get the link path (handle both wikilinks and markdown links)
const parsed =
link.type === "wikilink"
Expand Down
1 change: 1 addition & 0 deletions src/settings/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ export const DEFAULT_SETTINGS: TaskNotesSettings = {
pomodoroStorageLocation: "plugin",
// Editor defaults
enableTaskLinkOverlay: true,
disableOverlayOnAlias: false,
enableInstantTaskConvert: true,
useDefaultsOnInstantConvert: true,
enableNaturalLanguageInput: true,
Expand Down
13 changes: 13 additions & 0 deletions src/settings/tabs/featuresTab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,19 @@ export function renderFeaturesTab(
},
});

// Disable overlay for aliased links setting
if (plugin.settings.enableTaskLinkOverlay) {
createToggleSetting(container, {
name: "Disable overlay for aliased links",
desc: "Do not show the task widget if the link contains an alias (e.g. [[Task|Alias]].",
getValue: () => plugin.settings.disableOverlayOnAlias,
setValue: async (value: boolean) => {
plugin.settings.disableOverlayOnAlias = value;
save();
},
});
}

// Inline task card visible properties (shown when task link overlay is enabled)
if (plugin.settings.enableTaskLinkOverlay) {
const availableProperties = getAvailableProperties(plugin);
Expand Down
1 change: 1 addition & 0 deletions src/types/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ export interface TaskNotesSettings {
pomodoroStorageLocation: "plugin" | "daily-notes"; // where to store pomodoro history data
// Editor settings
enableTaskLinkOverlay: boolean;
disableOverlayOnAlias: boolean;
enableInstantTaskConvert: boolean;
useDefaultsOnInstantConvert: boolean;
enableNaturalLanguageInput: boolean;
Expand Down