Refresh all open Markdown views?

When my plugin loads, I register a Markdown code block processor to display relevant code blocks as something else.

If I manually enable my plugin from Settings, the relevant code blocks in my active Markdown pane correctly update—the ones in my inactive panes do not.

I suppose my plugin’s onload and onunload methods should call something to cause all open Markdown views to refresh, but I can’t find the right thing.

Any ideas?

1 Like

Placing this in both my onload and onunload methods does exactly what I want:

this.app.workspace.updateOptions();

From the docs:

updateOptions

updateOptions(): void;

Calling this function will update/reconfigure the options of all markdown panes. It is fairly expensive, so it should not be called frequently.

Please let me know if a more suitable, less expensive operation exists for this problem.