Testing version: iOS 2.0.10
What were you doing: Running a “text transformation” Shortcut I’ve been using for ages
What feature did you use: Apple Shortcuts via the selected text share sheet (i.e., select some text, then tap Share…
in the popup)
What happened: Shortcuts cannot “see” the url so it strips out the URL in a properly formatted markdown link
What did you expect to happen: For the returned text to include a properly formatted markdown link, including the URL
Background
I’ve had a Shortcut I call “Text Manipulator” for ages (long before the release of Bear 2). It basically takes any selected text in any app and performs a transformation on it, like converting lowercase to UPPERCASE and stuff like that. It also does some more complex stuff like converting my old style of Bear metadata to a YAML header.
The Issue in Detail
The problem is that Shortcuts can’t “see” a properly formatted markdown link in Bear. It must have something to do with the new editor because (as far as I can remember) this shortcut used to work just fine in Bear 1.
The way these Shortcuts work is by selecting some text, then tapping Share…
in the popup. This works fine for any “normal” text (including bold, italic, etc), however, it doesn’t work for links.
To make it work with links, I had to modify the Shortcut to grab text off the clipboard (which obviously means I’ve got to remember to manually copy the text before running the Shortcut). When I manually copy the text, things work just fine.
To explain better, here are some visuals.
Here’s some old metadata:
## Metadata
Date: March 01, 2017
UID: 201703011645
Sources: [On Finding Your Purpose: An Extraordinary Letter by Hunter S. Thompson](https://tranquilmonkey.com/hunter-s-thompsons-extraordinary-letter-on-finding-your-purpose/)
Notes:
Obviously in Bear this text will look identical to the above, however, it will have wysiwyg formatting on the link, so it will look like this:
Okay, so far so good and when manually copying this text, it looks as you would expect.
However, when you’re using Shortcuts to grab the text automatically, by doing something like this…
…if you’ve got a markdown link in there, the resulting text would be:
Date: March 01, 2017
UID: 201703011645
Sources: [On Finding Your Purpose: An Extraordinary Letter by Hunter S. Thompson]()
Notes:
This is because, for whatever reason, Shortcuts cannot see the URL “hidden” behind Bear editor’s wysiwyg styling.
To get this to work properly, as stated above, I had to change the Shortcut to grab the clipboard, which means I’ve got to manually copy the text before running it. So the Shortcut currently has to look like this:
I’ve tested this out using a simple UPPERCASE converter, and the results are exactly the same. You can test this yourself by building a Shortcut like:
If you select a markdown link that’s inside a code block or YAML header and run this, it will work fine. However, if you run it on a markdown link that the editor has applied the wysiwyg styling to, it will return everything as expected, however, the URL will be stripped out.
I would love to hear back from @Matteo or one of the devs (or anyone willing to test this on their phone) if they can reproduce this weirdness