Last active
          February 5, 2025 05:59 
        
      - 
      
- 
        Save hyperfocus1337/23b7efff7f8c1dcb0d8c36ac044b98d1 to your computer and use it in GitHub Desktop. 
Revisions
- 
        hyperfocus1337 revised this gist Feb 5, 2025 . 1 changed file with 7 additions and 6 deletions.There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,15 +11,16 @@ tags_slug = tags_array.join("_"); file_name = identifier + "--" + title.replace(/\s+/g, "-").toLowerCase() + "__" + tags_slug; // Rename the file with the constructed file name await tp.file.rename(file_name); // Join the tags array into a new format where each tag is on a new line prefixed by "- " formatted_tags = tags_array.map(tag => ` - ${tag}`).join("\n"); // Format the title with spaces (replace hyphens with spaces) title_with_spaces = title.replace(/-/g, " "); _%> <% "---" %> title: <% title_with_spaces %> date: <% date %> tags: <% formatted_tags %> identifier: <% identifier %> <% "---" %> <% tp.file.cursor() %> 
- 
        hyperfocus1337 created this gist Oct 26, 2024 .There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ <%* identifier = tp.date.now("YYYYMMDDTHHmmss"); // Generate unique identifier based on current timestamp date = tp.date.now("YYYY-MM-DDTHH:mm:ssZ"); // ISO format date title = await tp.system.prompt("Title"); // Prompt user for a title tags = await tp.system.prompt("Tags"); // Prompt user for comma or space-separated tags // Convert tags to an array by splitting on commas or spaces, remove extra spaces, and format them tags_array = tags.split(/[,\s]+/).filter(tag => tag.trim()).map(tag => tag.toLowerCase().trim()); // Format the tags into a slug format for the filename tags_slug = tags_array.join("_"); // Construct the file name (replace whitespaces in title with hyphens and append processed tags) file_name = identifier + "--" + title.replace(/\s+/g, "-").toLowerCase() + "__" + tags_slug; // Rename the file with the constructed file name await tp.file.rename(file_name); // Join the tags array into a comma-separated, quoted string for the output formatted_tags = tags_array.map(tag => `"${tag}"`).join(", "); // Format the title with spaces (replace hyphens with spaces) title_with_spaces = title.replace(/-/g, " "); _%> <% "---" %> title: "<% title_with_spaces %>" date: <% date %> tags: [<% formatted_tags %>] identifier: "<% identifier %>" <% "---" %> <% tp.file.cursor() %>