Jump to content

Adding <br>s to line breaks in text


Recommended Posts

Posted

Hi everybody. I'm starting to explore workflows and I'm stuck on how to get Alfred to add line breaks <br> to ends of lines in plain text. For example, I would like the following text

 

Line 1 text

Line 2 text

 

Line 3 text

 

to be manipulated to

 

Line 1 text<br>

Line 2 text<br>

<br>

Line 3 text<br>

 

Hope someone can point me in the right direction.

 

Thanks,

Gary

Posted (edited)

Welcome @garyinsf,

 

This can be accomplished with the Replace Utility.

TlhHoz3.png

 

Instead of (\n) and <br>$1, a better method would be to use \n and <br> and ⌥↵ after the <br> to enter a new line (but that doesn’t translate to a screenshot).

 

I can’t be more specific unless you specify how you want your Worlflow to work (or better yet, upload it for us to see). That utility will act on whatever text is passed to it and pass it through to the next node (which should probably be a Copy to Clipboard Output).

Edited by vitor
Posted

Thanks Vitor. I have set up the Replace as you have done above. I am manipulating clipboard contents and pasting using the Alfred hotkey for the workflow. However it is only pasting the exact text I copy without adding the <br>s. 

Screen Shot 2018-02-23 at 2.48.55 PM.png

Posted

Has stated before, we can’t properly help you without access to your Workflow.


Debugging can already be hard with access to the code, and you’re asking us to guess yours from a description and a screenshot. There are multiple places where you code or Workflow setup may be going wrong. Without looking at it we’re shooting in the dark.


See the Reporting Problems with Workflows topic, as it gives a nice overview on how to build an effective report.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...