Skip to content

Commit

Permalink
Exclude workspace when linking to a file
Browse files Browse the repository at this point in the history
  • Loading branch information
pderaaij committed Jul 19, 2024
1 parent 4a410d1 commit 2393a8a
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions packages/foam-vscode/src/features/preview/wikilink-navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,12 @@ export const markdownItWikilinkNavigation = (
return getPlaceholderLink(label);
}

const resourceLabel = isEmpty(alias)
? `${resource.title}${formattedSection}`
: alias;
const resourceLink = `/${vscode.workspace.asRelativePath(
toVsCodeUri(resource.uri)
)}`;
return getResourceLink(
`${resource.title}${formattedSection}`,
`${resourceLink}${linkSection}`,
resourceLabel
);
const link = `${vscode.workspace.asRelativePath(
toVsCodeUri(resource.uri),
false
)}${formattedSection}`;
const title = `${resource.title}${formattedSection}`;
return `<a class='foam-note-link' title='${title}' href='/${link}' data-href='/${link}'>${label}</a>`;
} catch (e) {
Logger.error(
`Error while creating link for [[${wikilink}]] in Preview panel`,
Expand Down

0 comments on commit 2393a8a

Please sign in to comment.