Convert HTML to Rich Text with script

Hi there, I have IFTTT applet that creates a new Airtable record when a Google calendar event begins. The description for the event comes in as HTML. I’ve been looking for a script that could convert the HTML to rich text so that it is more human readable in the base. I know about the Marked Preview app, but I don’t think that’ll be the best solution, since I will be embedding this base and I currently cannot embed apps. Any help is greatly appreciated.

I’m not certain, but I would question this approach.

If you are already using IFTTT, you would be far better off using Integromat because it supports HTM-to-Markdown transformations - I believe it is just another step in the recipe process (literally a 5 second task). I believe it uses regex to perform the transformations so it would be a lot less effort than making your own script to do this. @ScottWorld probably knows exactly what I’m referring to.

1 Like

Hi @Noah_Coleman,

Yes, @Bill.French is 1,000% correct! That’s 10x more than 100%, by the way. :wink:

That exact module that Bill linked to in Integromat will convert HTML into markdown, and then that markdown text can be sent into a RTF-enabled “long text” field in Airtable.

And then, Airtable will automatically translate the markdown into onscreen formatting for you. :slight_smile:

(Note, however, that Airtable only supports a subset of the markdown formatting that is available to us.)

So yes, using a HTML-to-markdown conversion like this would definitely be your quickest & easiest & most reliable way to convert HTML to markdown.

And, as @Bill.French also mentioned, you could completely eliminate IFTTT from your process altogether, and just use Integromat to do the ENTIRE process from start-to-finish:

Integromat could grab the calendar event from Google, convert its description from HTML to markdown, and then send it onwards to Airtable.

p.s. Oh, one other thing I should note: From my personal experience, descriptions from Google Calendar will only show up as HTML if you’ve applied formatting to your calendar event’s description. If you only have plain text in your calendar event’s description, it should show up normally (without HTML).

Thanks for the help @ScottWorld and @Bill.French. I’m looking into Integromat right now to see if it will be a good fit, but I’m still using IFTTT for now. Google only sends HTML when using formatting in the description, but I also figured out that if the description has MD syntax, it will be read into Airtable already formatted.

Ah, that’s a nice find!