Remove HTML tags before action

I have some drafts containing HTML tags from previous processing. I’d like to keep these tags, but would also like to send the draft to e.g. a translation service. How can I strip these tags not from the draft, but from what is sent by another action?

Thanks!

You could try this example from the directory:

It is a simple regular expression replacement for anything in < >. If it’s simple HTML that should probably do the trick.

I have seen this, but I don’t want to remove the tags from the draft, only from the query.

Well, the script itself is just a single line that you could reuse. If you used the script below, in a script action step, it would create a [[stripped]] template tag, which you could then use in the subsequent steps in your action:

let stripped = draft.content.replace(/<\/?[^>]+(>|$)/g, "")
draft.setTemplateTag("stripped", stripped)
1 Like