Copy to HTML+Find And Replace+Copy To Clipboard


I would like to achieve the following:

  1. Copy the text to HTML (actually done with the function Share %%[[draft]]%%)
  2. Once the HTML is rendered, find </p> and replace by </p><br />
  3. Copy the result to the clipboard (i guess that this can be achieved with : Clipboard, replace [[draft]])

So actually my issue is getting step 2 done right.

Thank you for your help !

Try this one-liner as a single script step:

app.setClipboard(draft.processTemplate("%%[[draft]]%%").replaceAll("</p>", "</p><br />"));
1 Like

I might ask what your overall goal is with this modification. If you are trying to get more space between paragraphs, it mght be better to look at doing that with CSS in the site where you are outputting this HTML than to clutter the HTML output with unnecessary line feeds.

Understood there may be a good reason for doing it this way, just curious what that would be.

Perfect, thank you very much !!

Actually, i have an issue with the line breaks in wordpress…
The line break appears in the editor, but not on the page…
I saw that this is a common issue on Wordpress.

I just found out that copy/pasting it like that resolves the issue.

As I am a newbie, If you have any better method to achieve the same result please share it with me :slight_smile: !

1 Like

For me it’s extra space round headings on Wordpress - where I don’t propose to fiddle with the CSS. But the replace() method is well known to me.