<%* 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 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() %>