fenjalien / obsidian-typst

Renders typst code blocks in Obsidian into images using Typst through the power of WASM!
Apache License 2.0
337 stars 16 forks source link

Typst blocks for globals variables #19

Open feelingnothing opened 1 year ago

feelingnothing commented 1 year ago

Not familiar with the codebase of typst or this plugin, but is this possible? Would be great to have some file-scoped globals, or, for example, some typst inside the settings for wide-scoped things.

fenjalien commented 1 year ago

Do you mean defining a variable in one code block then importing it from another? I was thinking implementing that at some point. There are also preambles in the settings...

feelingnothing commented 1 year ago

Preamble is great. I think that there should be either a switch in the settings that lets you define all blocks in the file as a scope, so that you can use variables from other blocks (kinda like jupyter notebook), or a special kind of block that makes it global on file scope

fenjalien commented 1 year ago

Defining something in the frontmatter would be possible that then affects all code blocks in the same file. However this won't work for math blocks as they don't have any idea which file they are in when created.