Skip to content

Instantly share code, notes, and snippets.

@23maverick23
Created May 5, 2024 04:31
Show Gist options
  • Save 23maverick23/a33c3da8ca59e6f3cf5ea4ef926b4ef8 to your computer and use it in GitHub Desktop.
Save 23maverick23/a33c3da8ca59e6f3cf5ea4ef926b4ef8 to your computer and use it in GitHub Desktop.
Obsidian: Fantasy Statblock Template Snippet

<%* // load dataview and statblock APIs const dv = this.app.plugins.plugins["dataview"].api; const bestiary = FantasyStatblocks.getBestiary(); // convert array of creatures to dataview array const creaturesAsDvArray = dv.array(Array.from(bestiary.values())); // replace array objects with creature name property let creaturesArray = creaturesAsDvArray.name; // present array as suggester (esc to cancel) let creature = await tp.system.suggester((name) => name, creaturesArray, true, "", 10); let name = await tp.system.prompt("Name:", "Unnamed", false); let imageUrl = await tp.system.prompt("URL:", "", false); -%>

dice: true
columns: 2
forceColumns: true
creature: <% creature %>
name: <% name %>
image: <% imageUrl %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment