Action

Denote Note

Posted by mph, Last update 9 months ago

This makes a note that conforms to the Denote specifiication for naming and content.

Line 1: Note title
Line 2: note tags (space delimited)
Line 3- : body of note

Denote: https://protesilaos.com/emacs/denote

Steps

  • script

    const content = draft.content;
    
    const lines = content.split("\n");
    const titleLine = lines[0].trim();
    const tagsLine = lines[1].trim();
    
    const tags = tagsLine.split(" ");
    const currentDate = new Date();
    const formattedTitle = titleLine.toLowerCase().replace(/[^a-z0-9]+/g, "-");
    const filename = `${currentDate.getFullYear()}${(currentDate.getMonth() + 1).toString().padStart(2, "0")}${currentDate.getDate().toString().padStart(2, "0")}T${currentDate.getHours().toString().padStart(2, "0")}${currentDate.getMinutes().toString().padStart(2, "0")}${currentDate.getSeconds().toString().padStart(2, "0")}--${formattedTitle}__${tags.join("_")}.org`;
    const fileTags = `:${tags.join(":")}:`;
    
    draft.setTemplateTag("tags", tags);
    draft.setTemplateTag("filename", filename);
    draft.setTemplateTag("fileTags", fileTags);
    
  • file

    fileNameTemplate
    [[filename]]
    folderTemplate
    template
    #+title: [[line|1]]
    #+date:  [[[date]] [[date|%a]] [[date|%H:%m]]]
    #+filetags:   [[fileTags]]
    #+identifier: [[date|%Y%m%dT%H%M%S]]
    [[line|3..]]
    local
    true
    writeType
    create

Options

  • After Success Archive , Tags: denote
    Notification Info
    Log Level Info
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.