Skip to content

Instantly share code, notes, and snippets.

@emisjerry
Last active January 9, 2025 02:03
Show Gist options
  • Save emisjerry/b49892562f8c48e5c5eb8c8330aadd99 to your computer and use it in GitHub Desktop.
Save emisjerry/b49892562f8c48e5c5eb8c8330aadd99 to your computer and use it in GitHub Desktop.
Cmd-WonderBox.md for Obsidian plugin: WonderBox
<%*
let lstWonderBoxes = {
"🔥 tip" : "tip,技巧",
"ℹ️ info" : "info,資訊",
"✏️ note" : "note,筆記",
"⚠️ Warning" : "warning,警告",
"⚡ Danger" : "danger,危險",
"✅ Success" : "success,成功",
"❌ Error" : "error,錯誤",
"⛔ Critical" : "critical,嚴重錯誤",
"🪲 Debug" : "debug,除錯",
"🛠️ Update" : "update,更新",
"❓ Question" : "question,問題",
"📋 Announcement" : "announcement,問題",
"📊 Progress" : "progress,進度",
"💡 Highlight" : "highlight,重點"
};
let keys = Object.keys(lstWonderBoxes);
// from = await tp.system.suggester(Object.keys(froms), Object.values(froms),false,'請選擇')
key = await tp.system.suggester(keys, keys, false, "Please select one");
if (!key) return;
let clip = await navigator.clipboard.readText();
// tp.system.prompt("輸入內容:", default_value, throw_exception, multi-line)
let body = await tp.system.prompt("輸入內容:", clip, false, true);
let symbol = key.substring(0,2);
let value = lstWonderBoxes[key];
let index = value.indexOf(",");
let text = value.substring(index+1);
value = value.substring(0, index);
if (key) return `:::${value}[${symbol} ${text}]\n${body}\n:::\n`;
%>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment