NotePlan 3 Daily Note and New Note Snippets

I finally got around to doing something with my kludgy NotePlan clipper extensions that have limited formatting functionality. Instead of rewriting the python-based Daily_NotePlan and Clip2NotePlan extensions, I went for the simplicity of snippets.

Edit the below as needed, it should be pretty straightforward using the NotePlan x-callback docs.

Updated 2022-02-09: cleaner code, better headers for non-html sources

Clip to Daily Note

# PopClip - NotePlan Daily Note
name: DailyClipper
icon: symbol:calendar.badge.plus
capture html: true 
javascript: | 
  let clipping = popclip.input.markdown
  if (popclip.context.browserUrl.length > 0) { 
    let title = encodeURIComponent(popclip.context.browserTitle)
    clipping = `# ${title}\n` + clipping
    clipping += `\n[${popclip.context.browserTitle}](${popclip.context.browserUrl})\n#clipped`
  } else {
    let fname = popclip.input.markdown.split(' ').slice(0, 7).join(' ') + `…`
    clipping = `# ` + fname + `\n` + clipping + `\n#clipped`
  }
    clipping = encodeURIComponent(clipping)
    popclip.openUrl(`noteplan://x-callback-url/addText?noteDate=today&text=${clipping}&mode=append&openNote=yes`) 

Clip to New Note

# PopClip - NotePlan New Note
name: NP3Clipper
icon: symbol:asterisk
capture html: true 
javascript: | 
  let clipping = popclip.input.markdown
  if (popclip.context.browserUrl.length > 0) {
    let title = encodeURIComponent(popclip.context.browserTitle)
    clipping += `\n[${popclip.context.browserTitle}](${popclip.context.browserUrl})\n#clipped`
    clipping = encodeURIComponent(clipping)
    popclip.openUrl(`noteplan://x-callback-url/addNote?noteTitle=${title}&text=${clipping}&openNote=yes`)
  } else {
    let fname = popclip.input.markdown.split(' ').slice(0, 7).join(' ')
    clipping = `# ` + fname + `\n` + clipping + `\n#clipped`
    clipping = encodeURIComponent(clipping)
    popclip.openUrl(`noteplan://x-callback-url/addNote?text=${clipping}&openNote=yes`)
  }
4 Likes

Looks great @brokosz, welcome and thanks for sharing!

Cheers, @nick - thanks for all the functionality. If I get some more time this week, I’ll try to consolidate this down to a single with a modifier.

Love this. Thanks very much, @brokosz.

1 Like

Very useful indeed. Thanks!

Brokosz,

Many thanks - I wish I could buy you a beer!

Mark