Is there a block to render simple HTML?

I use Airtable to hold content parsed from HTML emails. The html content is in a long text field.

I want a Block that I can use to render the message content from those emails.

Does this exist?

1 Like

There is a way, but it is hypothetical - it goes like this:

  1. Read the HTML content field.
  2. Transform the content (as best possible) into Markdown.
  3. Render using output.markdown() in the block.

Step #2 is the challenge, but there are many javascript libraries (like this one) that you could choose from and that would run as a function inside your script block.

You could also build your own transformation function that targets specific HTML tags and sanitized the content for all those that you don’t really care about.

@Richard_Foxworthy This doesn’t exist, but it would be a welcome addition to the blocks! There is a custom block contest going on right now… perhaps you can suggest it to someone to build this block for the contest!

This should be possible with a Custom Block.

  1. Read the template
  2. Substitute all the mergetags
  3. Render HTML.
  4. Use it as input for your email.

Without the Custom Block:
You should be able to write a simple version using “SUBSTITUTE” formula. Since your template can contain a limited number of merge tags, you should be able to substitute all of them one after another. Arrays and loops might be a challenge.

Thanks for replies so far, just want to clarify that my own use case is that I parse html content from incoming emails (using Zapier) and write the html message content to an Airtable long text field.

I want only to render and view that message content in a block - ie to view the message content similar to how it would render in a standard email client - I don’t need to view or edit the actual html code.

I do not need to generate and send html email message content out of Airtable - although I can see that could be very useful functionality for other use cases…

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.