








{scratchpad} as scratchpad
---
if (!context.bound.scratchpad) {
return ``;
}
const currentFile = app.workspace.getActiveFile();
const filename = currentFile.basename;
const foldername = currentFile.parent.path === "/" ? "" : currentFile.parent.path;
const embedPath = foldername ? `${foldername}/${filename}` : filename;
const fullPath = `${embedPath}.excalidraw.md`;
const existingFile = app.vault.getAbstractFileByPath(fullPath);
if (!existingFile) {
const ea = ExcalidrawAutomate;
ea.reset();
await ea.create({
filename: filename,
foldername: foldername,
templatePath: "Excalidraw/Template.excalidraw",
onNewPane: false,
silent: true,
});
}
const title = "## Scratchpad" + "\n\n";
return engine.markdown.create(title + `![[${embedPath}.svg]]`);
