Describe your feature request
A clear and concise description of what you want to happen.
Right now the "Add Selection to FSNotes" service just grabs plain text. It doesn't preserve links in the text and it doesn't preserve the URL of the source page. I would like an updated version that grabs selected text with markdown formatting so that links are preserved, and appends the URL of the source page (and perhaps the title as well?) at the bottom for future reference.
Additional context
Add any other related information here. macOS or iOS?
Would be good if there was a share extension on iOS that worked similarly. I haven't looked into this yet.
I tried this originally and Rich Text wouldn't work as a Service so I had to do Plain Text.
Any thoughts @glushchenko ?
@gingerbeardman maybe just use markdown Plain Text syntax
Interesting idea, to convert to markdown in the service. I'm not sure how easy that will be but will give it some thought.
I tried this again and the problem is that for our use case the Automator workflow processes only plain text from the browser.
Rich text is available to create a new TextEdit note, for example, but when sending the text to another app as we do, only plain text is used.
We need some way of:
Alternatives
No worries, I have a first version working (with one caveat)
Feel free to open in Automator and try to improve what I have so far.
(download below)
Credits
I had uploaded a broken version, fixed version now above.
Line breaks are removed in the part of the workflow that creates the URL. Trying to fix now.
Here we go!
An AppleScript voodoo incantation about delimiters solved the line break issue.
use framework "Foundation"
use scripting additions
on run {input, parameters}
set AppleScript's text item delimiters to {return & linefeed, return, linefeed, character id 8233, character id 8232}
set myText to input
set nsInput to current application's NSString's stringWithString:("fsnotes://new/?txt=" & myText)
set characterSet to current application's NSCharacterSet's URLQueryAllowedCharacterSet()
set escapedInput to (nsInput's stringByAddingPercentEncodingWithAllowedCharacters:characterSet) as text
return escapedInput
end run
Working download:
Add Selection as Markdown to FSNotes.workflow.zip
Also added to Wiki page.
Have fun!
Most helpful comment
@gingerbeardman maybe just use markdown Plain Text syntax