Clip selection to Obsidian

Great stuff!

You must replace the string test vault

This made me think to add another example showing how we can add an option to the extension for setting the vault name:

# PopClip - Obsidian extension, markdown variant
name: OBSClipper
icon: O
options:
- identifier: vault
  label: Vault Name
  type: string
capture html: true # this is needed when we want markdown text
javascript: | 
  const vaultName = encodeURIComponent(popclip.options.vault)
  let clipping = popclip.input.markdown
  if (popclip.context.browserUrl.length > 0) { // append markdown source link if available
    clipping += `\n[${popclip.context.browserTitle}](${popclip.context.browserUrl})`
  }
  clipping = encodeURIComponent(clipping)
  popclip.openUrl(`obsidian://advanced-uri?vault=${vaultName}&daily=true&heading=Clippings&data=%0A${clipping}&mode=append`)
#end
2 Likes