Advertisement
averagetrailertrash

Obsidian Bookmark Template

Jan 15th, 2023 (edited)
355
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <%*
  2. // This is the general idea, abstracted from a more involved template.
  3. // It assumes the URL of your bookmark is currently in the clipboard.
  4. // edit - adjusted this so this template also creates the file
  5.  
  6. await tp.file.create_new("", "path/to/your/bookmarks/untitled_bookmark", true);
  7.  
  8. var userClipboard = await tp.system.clipboard();
  9.  
  10. var titleHere = await tp.system.prompt("What should this file be named?");
  11.  
  12. var renameMe = true;
  13.  
  14. if (titleHere == "") {
  15.     titleHere = tp.file.title;
  16.     renameMe = false;
  17. }
  18.  
  19. var introHere = await tp.system.prompt("Provide a brief description of this file.");
  20.  
  21. tR += "---\n";
  22. tR += "title: " + titleHere + "\n";
  23. tR += "tags: bookmark\n";
  24. tR += "cssclass: \n";
  25. tR += "---\n\n";
  26.  
  27. tR += "# " + titleHere + "\n";
  28. tR += "(intro:: " + introHere + ")\n\n";
  29.  
  30. tR += "## Outlinks\n";
  31. tR += "* [url:: " + userClipboard + "]\n";
  32. tR += "* [goto:: [" + titleHere + "](" + userClipboard + ")]\n\n";
  33.  
  34. tR += "---\n# Main Note\n\n";
  35. tR += "<iframe src=\"" + userClipboard + "\"  width=\"100%\" height=\"600px\"></iframe>\n\n";
  36.  
  37. tR += "---\n# Questions & Ideas\n * \n\n---\n# Change Log\n *\n\n---\n#Footnotes";
  38.  
  39. if (renameMe == true){ await tp.file.rename(titleHere); }
  40. %>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement