Add my handrolled Obsidian extension for PopClip
This commit is contained in:
parent
cbe482664b
commit
577c2daa72
3 changed files with 34 additions and 0 deletions
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
name: OBClipper
|
||||
identifier: me.00dani.obclipper
|
||||
icon: iconify:simple-icons:obsidian
|
||||
popclip version: 4225
|
||||
options:
|
||||
- identifier: vault
|
||||
label: Vault Name
|
||||
type: string
|
||||
default value: silica
|
||||
|
||||
shell script file: clip.zsh
|
||||
capture html: true
|
|
@ -0,0 +1,9 @@
|
|||
#!/bin/zsh
|
||||
uriencode() {
|
||||
jq -nr --arg input $1 '$input | @uri'
|
||||
}
|
||||
|
||||
HOOK="$(osascript -l JavaScript hooked.js)"
|
||||
CLIPPING="$POPCLIP_MARKDOWN"
|
||||
[[ -n $HOOK ]] && CLIPPING+=$'\n'"$HOOK #clipped"
|
||||
exec open "obsidian://advanced-uri?vault=$(uriencode $POPCLIP_OPTION_VAULT)&daily=true&mode=append&data=$(uriencode $CLIPPING)"
|
|
@ -0,0 +1,12 @@
|
|||
(function() {
|
||||
const titleSpecials = /([\[\]\\*_])/g;
|
||||
const urlSpecials = /([()\\])/g;
|
||||
const mdEscape = (str, specials) => str.replace(specials, '\\$1');
|
||||
const app = Application('Hookmark');
|
||||
let mark = app.bookmarkFromActiveWindow();
|
||||
if (typeof mark === 'string') {
|
||||
delay(1);
|
||||
mark = app.bookmarkByRequestHandle(mark);
|
||||
}
|
||||
return `[${mdEscape(mark.name(), titleSpecials)}](${mdEscape(mark.address(), urlSpecials)})`;
|
||||
})();
|
Loading…
Reference in a new issue