QoL changes for pasting pdf selection links in notes

Use case or problem

In my university work, I use and abuse the “copy link to selection” feature with pdf highlighted text for sourcing claims in my notes. It is probably my favorite feature of Obsidian.

I initially used the default generated wikilink formatting, which when you paste looks like so:
[[Pdf.pdf#page=2&selection=10,2,25,10|Pdf, page 2]]

My problem is that I rarely want the “Pdf, page 2” text so i always change it to something else. This involves a small but irritating amount of steps, especially if you do it repeatedly, which breaks my workflow somewhat.

Proposed solution n°1

When pasting a link, the “Pdf, page 2” should be empty and the cursor placed between the “|” and the “]]”, so that the steps to paste a highlight link would be:

  • Highlight the text in the pdf
  • Copy link to selection
  • Paste the link in your notes
  • Write the link alternative text (or delete the “|” with backspace if you want the raw link)
  • Click right arrow 2 times to escape the ]]
  • Continue writing the notes

It would feel much more natural imo.

Working with markdown links

Trying to find a workaround, I found out that you can disable the auto-generation of wikilinks and instead generate markdown links in the settings. When you paste a link to a pdf highlight, you get this instead:
[ ] (Pdf.pdf#page=2&selection=10,2,25,10)
(without the spaces inside)

This is slightly better because it does not have default text, so you don’t need to erase it before adding your own. However, it still has problems. after pasting, the cursor is at the end of the link instead of between the brackets which is weird. Surely, the user will want to add some text to the link instead of leaving an invisible link hiding in the notes. A quick fix would be having the cursor in between the brackets after pasting the link.

Despite this, that’s the “workaround” I currently use.

(almost) Pasting a link onto existing text

I’ve recently found out that you can automatically format selected text as a markdown link using Ctrl + k. It even puts the cursor automatically between the parenthesis. So when you want to quickly insert an external link into your notes, you do:

  • Copy the url
  • Select the text in your notes
  • Ctrl + k
  • Ctrl + v
  • Right arrow

When I tried this with a pdf selection markdown link, instead of getting:
“[text] (Pdf.pdf#page=2&selection=10,2,25,10)”
I got a broken:
“[text] ([ ] (Pdf.pdf#page=2&selection=10,2,25,10))”
(without the spaces)

Proposed solution n°2

Make the pasted markdown link be directly “Pdf.pdf#page=2&selection=10,2,25,10” without the formatting (easy solution) or make the pasting conditional so the ctrl + k formatting doesn’t break when pasting the link inside.

1 Like

Just a warning: your workaround is actually relying on a bug that was fixed in v1.7.0.

My plugin PDF++ does this exact thing, so you might want to check it. But I do hope this can be done without plugins.