Search and Replace html tag

I use Ulysses to write my newsletter and then I do a copy html and paste it into Mailchimp. However, I don’t like the way the paragraph tag renders. I much prefer 2 line breaks instead. So I’ve been manually deleting the page tag and subbing in the break tag which is a pain.

Now that I have a little time to think about this, I looked into Ulysses and I can create a ‘soft line break’ by hitting shift-Return. But it’s a hassle to remember to do that when I’m just focused on writing.

So then I thought I could copy/paste the html code into another sheet and then do a search/replace but that’s a hassle because I’m dealing with html tags. (I could set up a text expansion but it’s still not my favorite solution.)

But then I saw someone mention TextSoap doing some cleanup. I have never used TextSoap.

Does anyone have any recommendations on doing this, with or without TextSoap? I’m not even sure TextSoap is a solution.

Thanks

You can do this with a Terminal command:

sed -i.bak 's@whatyouhave@whatyouwant@g' file.html

This will change all occurrences of whatyouhave to whatyouwant in the file file.html and create a backup of it before changes named file.html.bak.

You could also use an editor to make the search-and-replace changes. I recommend TextMate, but there are hundreds of others.

2 Likes

As you noted, the solution in the app is Shift-Return for a soft-line-break. This is the solution. Just remember to Shift-Return when you’re working with html export. Anything beyond that seems like a lot of superfluous work and time.

Yeah, it’s quite possible that using shift-return is the solution. I can edit my template which will help and then do a pass over at the end.

I just looked but I didn’t see it. Do you know if there is a way to show if a paragraph tag was used? (I don’t know what to call that. I’m pretty sure Word has this functionality.) I know if I highlight the text, I can see where I used paragraph vs line breaks. It would be great to have that turned on and I can then quickly make the edits.

I don’t know how or if you can view invisibles in Ulysses. (That’s one of the many abilities in the free version of the BBEdit [Mac only] text editor, which also does awesome search/replace, by the way.)

One other thing: I’m not sure but maybe in Ulysses you can make Return act like Shift-Return by created a tweaked personal Markup, as described here:

Thank you. I will check that out and post back here one way or another.

As far as I can tell, theres no ‘Definition’ for Paragraph formatting in the Markup preference. I will send a note to them to see if there is a workaround.

Unless MailChimp doesn’t allow it, I would try inline CSS first. Change your paragraph tags from <p> to

<p style="margin-top: 2em">

or whatever spacing looks best to you. How best to go about automating this change depends on which platform you’re working on and which apps you own, but it’s a simple search and replace. You don’t even need regular expressions.