Skip to content

Commit

Permalink
Add file variable for current file access in eval context
Browse files Browse the repository at this point in the history
  • Loading branch information
udus122 committed Nov 16, 2024
1 parent ab596a7 commit 3eb74bf
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/dataview-publisher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ export async function executeBlock(
if (
["dataviewjs", "javascript", "js"].some((x) => block.language.startsWith(x))
) {
// Define to access the current file object as file within eval
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const file = tfile;
const evalResult = eval(block.query);
return evalResult.trim();
}
Expand Down

0 comments on commit 3eb74bf

Please sign in to comment.