Action

Append to List

Posted by @gavmn, Last update about 2 years ago

Prompts you to choose a markdown file in a given bookmark and then appends the current draft to that file.

Steps

  • defineTemplateTag

    name
    file
    template
  • script

    let bookmark = Bookmark.findOrCreate("Lists");
    let fm = FileManager.createForBookmark(bookmark);
    let contents = fm.listContents("/").sort();
    
    let p = Prompt.create();
    p.title = "Choose a list";
    
    contents.forEach(listFile => {
    	p.addButton(listFile.replace(".md","").replace("/",""));
    })
    
    var didSelect = p.show();
    
    if (didSelect) {
    	draft.setTemplateTag("file",p.buttonPressed);
    } else {
    	context.cancel();
    }
  • file

    fileNameTemplate
    [[file]].md
    folderTemplate
    /
    template
    - [[draft]]
    local
    true
    writeType
    append

Options

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