Convert HTML tags to plain text?

Can anyone advise the best way to turn this HTML block of text into plain text?

I’ve tried some Regex patterns and Find & Replace to no avail. My desired outcome is just to be able to have the useful text i.e.

“Pure Vintage Gold. La Aurora Reserva Especial 2008 has been a long time coming. …”

<div class=\"powr-popup\" id=\"033f47ae_1626323307\"></div>\n<div class=\"powr-popup\" id=\"2bc53434_1564800913\"></div>\n<p>Pure Vintage Gold</p>\r\n<p>La Aurora Reserva Especial 2008 has been a long time coming. The cigar was produced with tobaccos harvested during 2008 season and left to ferment in La Aurora&rsquo;s aging room.&nbsp;&nbsp;</p>\r\n<p>Draped in an Ecuador Sumatra wrapper with fillers from Brazil, the Dominican, and Nicaragua beneath the sheets. Experience notes of molasses, earth, and roasted nuts. Along with the complex flavors - this cigar&rsquo;s woody aroma pushes it over the edge into classic territory. This is one delicious vintage I wish would stick around forever, but as it goes, this is a limited release. So, make sure to order quickly to make sure you can sample one of La Aurora&rsquo;s most luxurious cigars in its portfolio.</p>

1 Like

maybe this helps you!!

I have a solution to this using the toolbox plugin.
The video explaining the plugin in here: https://youtu.be/9jVEzPLRebI
In my case the html I am working with is the html from tweet content.

  • install the toolbox plugin
  • add the Javascript to Bubble element to your page
  • I named mine ‘javascript html to text’
  • fill in the function name within the element. I called mine ‘text’ which results in a function called ‘bubble_fn_text’
  • Enable the Publish value checkbox
  • Specify the Value type as text

In your workflow

  • define the first action as the one that gets the html you are working with, so you can referencing this is the next action. In my case this is step 1 [ alternatively you could reference any other source and update the script accordingly]

  • Add another action to ‘Run Javascript’

  • paste in this javascript below

    const span = document.createElement(‘span’);
    span.innerHTML = Result of step 1 (Twitter - Embed T…)'s body html:formatted as JSON-safe;
    const result = span.textContent || span.innerText;
    bubble_fn_text(result)

Note:

  • the formatting as json-safe is required to correctly manage the escaping of quotes

screenshots
image
image

result:

6 Likes

This topic was automatically closed after 70 days. New replies are no longer allowed.