Action

Send to Obsidian with Tags

Posted by Sean C. Higgins, Last update over 3 years ago

Playing with Obsidian, created a script to send notes to Obsidian. Based on Ulysses sheet w/ tags.

Update variable vaultName with the name of the vault you want the note to be in.

Tags are appended to the draft in Obsidian format for Obsidian’s benefit.

Steps

  • script

    // 
    // Send to Obsidian with Tags
    // 
    // Built from Ulysses sheet w/ tags
    // 
    // Tags are appended to the note
    // 
    // Modify vaultName with the vault you want the note in.
    // 
    const baseURL = "obsidian://new";
    const vaultName = "Test Vault";
    
    let cb = CallbackURL.create();
    cb.baseURL = baseURL;
    cb.addParameter( "vault", vaultName);
    cb.addParameter( "name", draft.displayTitle);
    // 
    // Adding Tags to the end of the draft, make sure there are no spaces in the Drafts tags
    // 
    let tags = draft.tags;
    let ctags = "";
    for (let i = 0; i < tags.length;i++) {
    	let nstag = "#" + tags[ i].replaceAll( ' ', '_');
    	ctags += nstag;
    	ctags += " ";
    }
    // 
    // Add a separater and then add the tags
    // 
    draft.append( " ");
    draft.append( "---");
    draft.append( " ");
    draft.append( ctags);
    cb.addParameter("content", draft.content);
    cb.waitForResponse = false;
    var success = cb.open();
    

Options

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