HananoshikaYomaru / obsidian-run

Generate markdown from dataview query and javascript.
https://yomaru.dev
MIT License
34 stars 2 forks source link

Feature Request: Allow page-level scoping of variables / Allow variables to be used in all "block run" sections on the same page. #6

Closed StefanoRausch closed 1 year ago

StefanoRausch commented 1 year ago

Variables are scoped to the run block they are defined in and cannot be used in other blocks on the same page.

The usability of the plugin can be enhanced even further if the scoping of variables is extended to the page level. That would allow users to define variables in one block for re-use in any other (following) blocks.

HananoshikaYomaru commented 1 year ago

this can be easily done using the yaml because I patched the file object

---
bar: "foo"
---

%% run start file.properties.bar %%

I should update the doc.

StefanoRausch commented 1 year ago

If I am not mistaken one cannot add:

const modal = app.plugins.plugins.modalforms.api
const obs = await self.require.import("[[user.script.obsidian.delay-until-synced.mjs]]")
// ...

to the frontmatter and use it in a JavaScript code block.

Edit: Even putting a Templater execution commands block before the frontmatter and referencing the variables in the YAML section does not pan out.

HananoshikaYomaru commented 1 year ago

OK but this seems like another issue... Can you open another feature request or bug report? Let's make it as descriptive as possible so that I know what exactly you want to do.