Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-render on theme change #33

Open
trombonehero opened this issue Oct 23, 2023 · 1 comment
Open

Re-render on theme change #33

trombonehero opened this issue Oct 23, 2023 · 1 comment
Labels
enhancement New feature or request question Further information is requested

Comments

@trombonehero
Copy link

I'm using the following in my shared preamble to adapt to light and dark Obsidian themes:

#let foreground = if THEME == "dark" { white } else { black }
#set text(fill: foreground, size: SIZE)

This works OK as long as the Obsidian theme doesn't change, but at sunrise/sunset when my Obidian switches, the rendered Typst output doesn't. Can an Obsidian plugin re-render when the theme changes? If not, is there a keyboard shortcut for "re-render all of my Typst content"?

@fenjalien
Copy link
Owner

Can an Obsidian plugin re-render when the theme changes?

I'm not aware of an event fired by Obsidian for it and it could be possible using a Mutation Observer but that would be difficult/buggy as each typst block instance manages itself.

Is there a keyboard shortcut for "re-render all of my Typst content"?

Not directly no for the same reasons as before. You have the option to close and reopen the page, select everything in the page then deselect (doesn't work for math blocks, inline math blocks work). Or the best catch-all is the built-in command "Reload without saving", which is basically a page refresh. Don't worry about the "without saving" part as long as you have auto-save on/save before reloading. Its not assigned to a hotkey by default but on my windows machine I have it on ctrl+r.

@fenjalien fenjalien added enhancement New feature or request question Further information is requested labels Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants