[share extension] How to append with a line break

First - I’m sorry if this in the wrong category.

If sharing something from another app to Drafts and appending or prepending it to an existing draft, how can I create a line break before or after without having to manually do so each time?

Thanks in advance!

Btw, when you share a draft to twitter, do the tags appear as hashtags in the tweet? I guess that could be scripted as an action.

TL;DR: how do I append shared text with a preceding line break

Edit: switched words for clarity

The share extension already adds a line break when appending/prepending, should not need to do anything special there.

Hashtags are hashtags.There is nothing special to do to mark a hashtag for Twitter other than using the # sign.

Sorry for all the confusion created on my part. Thank you for taking the time to answer my questions.

Is there a way to have it add an additional line break?

Sorry, I meant to ask if the document/draft tags could be transferred over into the tweet body as hashtags.

Just wanted to bump this thread in case anyone has any useful idea.

Currently when I share things successively, it looks like:

Title
Link
Title
Link

Instead of:

Title
Link

Title
Link

It doesn’t seem like a big deal in the examples, but it looks messier when you see it in practice.

Thanks in advance.

1 Like

What does your share extension look like?

For example mine includes line breaks and looks like this:

My share extension looks like that. I’m trying to insert an extra line break (which I didn’t make clear initially). Would you happen to know how to include one?

Maybe I’m misunderstanding the question, and I apologize if I am, but when I tap into the WEB TEMPLATE space in the settings screen that sylumer posted above (Settings->Share extension), I can append or prepend a number of line breaks (using the “return” key on the standard iOS onscreen keyboard) to the beginning or end of the template and the extension appears to include them when I use it.

1 Like

The web template only seems to work from safari. (The help text specifically says Safari.) Below, the first is from Safari, the next 2 are from twitter, and the last two are from chrome. Maybe this is what’s happening?

[macOS - Safari - Apple](https://www.apple.com/safari/)

> 


https://twitter.com/agiletortoise/status/1020340013219942400?s=12
https://twitter.com/agiletortoise/status/1020340013219942400?s=12
https://agiletortoise.com/
https://agiletortoise.com/

‘’’

3 Likes

Excellent spot! The OP does make reference to Twitter on the secondary part, just not the first so coming from some Twitter client does make sense.

If that’s the case then I can see two options.

  1. Use a different method of getting the content into Drafts that includes the line break. This could be accomplished with a share sheet enabled workflow in Workflow for example that receives the Twitter information and then appends it to the draft.
  2. Let the shared info build up and then run a Drafts action to format the information afterwards. This could be done by checking for URLs on a line and checking that is is followe by a blank line - where it isn’t a blank line is inserted.

I guess copy & paste and iPad split screen may offer some additional minor variations as well.

1 Like

You can manually add the new lines in non safari cases before hitting save.

https://twitter.com/agiletortoise/status/1021588677619867650?s=12


https://twitter.com/juliainor/status/1021620868970033152?s=12


An action that spaces seems like the best approach.

I’m guessing this is some technical limitation outside of Safari. Wonder what it is?

1 Like

Thanks for the observations and suggestions, all. I would enter a line break before hitting save, but it would become tedious having to do it dozens of times or going back to the document later, if compiling a list of links for different subjects.

I am trying to do the same thing. I have tried various ways to add a line break into my web template without success. I want to separate, with a space, each entry that I append.

Is there anyway to add a line break without doing this manually? When I have numerous entries, this can be tedious as mentioned above.

Thank you.

Workflow is now Apple Shortcuts.

You mention your web template which works with Safari. Can you clarify what you have and what you are attempting to do from where? A common point that people miss)it is in the docs) is it only applies to the toolbar share sheet button.

1 Like

I am using the share option to save several web URLs to one single draft note (This will basically be a list of references for several scientific studies).

If possible, I would like to have a line break inserted between each entry without having to do it manually, if possible.

Without a line break between each, all the entries are bunched together without a blank line between them.

Hope this makes sense.
Thank you!

Unfortunately that still leaves quite a few gaps/assumptions in what you are doing. Precision and detail are key when trying to figure out what the problem is given the solutions already provided earlier in the thread - otherwise we end up providing an answer to the wrong problem.

The alternative is to put together multilpe sets of details and hope that they cover your situation. That’s what I’ve tried to do below. Hopefully, there’s somerthing in there to help you.

On the Mac

On the Mac, browsing in Safari, I can select the share button in the Safari toolbar, select the share to Drafts option, specify to append to an existing draft, and it uses my set up (from Draft’s preferences, also shown in the screenshot) for the Drafts web capture template to capture the link and selection.

Notice the line numbering in the share extension pop up and how it includes a blank line after the text being added.

The result therefore is spaced out content as you describe as your desired output.

Here’s a copy of the template from the screenshot above.

[[[title]]]([[url]])

>[[selection]]

On the iPhone

If I use Safari on my iPhone (i could do the same thing on an iPad), I can select the share sheet button from the Safari toolbar (not the page selection share option), to bring up the Drafts sharing window. In that, I can once again set it to append to my existing link collection draft, and note once again, the additional blank line at the end of the captured content that will be appended to the draft. Again, this is being picked up from the web capture template in Drafts.

Speed It Up with a Custom Approach

If I was regularly switching drafts to assign to, or I wanted to speed things up, I would consider creating a shortcut (as I noted above) for my most regular reserach draft destination. I could use Shortcuts to grab the Safari page’s URL and build just a title and URL (probably as a Markdown link as shown above),but dropping the text selection option. If necessary I’d add some dictation to capture a text note to go with it.

I would then assign it to a keyboard shortcut on the Mac.

I would assign it to a back tap combo for the iPhone.

On the iPad, I guess I’d just have it up in split screen while researching as neither of the other two options are available (yet) on that platform - at least not without jailbreaking the iPad!

Hope that helps.

1 Like

:woman_facepalming: The problem was that I was using the Brave browser which I use instead of Safari. However in Brave, it doesn’t work the same. In Safari, it works perfectly. Thank you for the detailed explanation. This was very helpful.

Brave will send what it can, but as I’m sure you now realise, Safari has deeper hooks into the system and can share a bit more.

I would therefore go back to the Shortcuts suggestion and use it that to build your own customised version of the link share. Drafts is very Shortcuts friendly.

1 Like