Last active
July 26, 2023 20:18
-
-
Save johnghill/6ffedba711f792a3791cd74d264c0b7b to your computer and use it in GitHub Desktop.
[espanso] [zotero] [logseq] Reads path from clipboard and converts it to relative markdown link compatible with Logseq's internal PDF viewer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
matches: | |
# Reads path from clipboard and converts it to relative markdown link compatible with Logseq's internal PDF viewer | |
# Note: parent directory wildcards ../../ are URL-encoded: %2e%2e/%2e%2e/ | |
# Note: amend line 18; check that expanso service is running; tigger using :xpdf keystrokes | |
# Bug: Espanso reads ! from ![]() as a negation. My workaround is to add !! which you'll need to trim in Logseq | |
- trigger: ":xpdf" | |
replace: "!![~/Zotero/storage/{{alphanumeric}}/{{filename}}](%2e%2e/%2e%2e/%2e%2e/Zotero/storage/{{alphanumeric}}/{{filename}})" | |
vars: | |
- name: clipboard_content | |
type: shell | |
params: | |
cmd: "xclip -selection clipboard -o" | |
- name: alphanumeric | |
type: shell | |
params: | |
cmd: "echo '{{clipboard_content}}' | grep -oP '/home/user/Zotero/storage/\\K[A-Za-z0-9]+'" | |
- name: filename | |
type: shell | |
params: | |
cmd: "echo '{{clipboard_content}}' | grep -oP '/[A-Za-z0-9]+/\\K[^/]+\\.pdf'" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment