Copy page link to markdown

Does anyone know of a way to copy a page link with the title of the document? I would like to paste the page link from a PDF file into a markdown file like this [Title of document](devonthink page URL). I found a script to copy item link this way, but I would love if this worked with copy page link as well.

Thanks!

I modified some helpful code by Korm to solve my problem. The script copies the selected content to the clipboard as well. Here is the script if anyone needs it…

-- Copy selected text in PDF and append markdown style page link
-- Original script:
-- 20140818 -- made by korm -- adjust as your wish, but please attribute copies
-- see https://discourse.devontechnologies.com/t/new-rtf-doc-from-selected-text-with-url-to-pdf/14512/1

tell application id "DNtp"
	set thisItem to content record
	set theText to selected text of think window 1
	
	if theText is {} then
		error "Select some text"
	end if
	
	if the current page of think window 1 ≠ -1 then
		set thePage to "?page=" & ((the current page of think window 1) as string)
	end if
	
	set theUrl to reference URL of thisItem & thePage
	set the clipboard to theText & " " & "[" & name of thisItem & "](" & theUrl & ")"
	
end tell

This now seems to be the default. I’ll copy the item link from another page in the group. When I paste it into another Markdown document it gives me \[title of document](link), even if I’ve already formatted it. I use long document titles because I want them to make sense in search, but there’s no reason for an excessively long title in what’s essentially an index page. So what I want to do is type: \[outline](pastelinkhere) and what I get is \[outline]([Long title with name of project and that its an outline](item link)). It’s annoying and I know I can go back and edit it back, but that takes 20 seconds probably thirty times a day. Is there a way to fix this?

Welcome @bergblom

This now seems to be the default. I’ll copy the item link from another page in the group. When I paste it into another Markdown document it gives me title of document, even if I’ve already formatted it.

Yes, pasting an item link into a Markdown document inserts a properly formatted Markdown URL. This is the majority request from our userbase.

So what I want to do is type: outline and what I get is [outline]([Long title with name of project and that its an outline](item link)).

You can use Edit > Paste and Match Style to override the default behavior.

Wonderful! Thanks for letting me know how.

You’re very welcome :slight_smile: