Support for assets in plugins

I think it would be nice to have a way of including static files in plugin releases without having to inline them in the main.js file.


  • would be downloaded from the GitHub release if present and extracted into .obsidian/plugins/{PLUGIN_NAME}/assets
  • API call to make reading from the folder convenient (this.plugin.readAsset(relPath: string): TFile)?

Security shouldn’t be much of a concern since plugins can already execute arbitrary code.


Use cases:

  • Including example markdown files with plugin
  • Including images and other static resources needed for the plugin

try this:

export function buildPluginStaticResourceSrc(plug: Plugin_2, assetPath: string) {
  return, "plugins",, assetPath))

/* usage */
element.createEl("img", { attr: { src: buildPluginStaticResourceSrc(this,  "example.png") }});