Help

Save the date! Join us on October 16 for our Product Ops launch event. Register here.

Re: Convert Rich Text to Markdown with Airtable Extension

2270 1
cancel
Showing results for 
Search instead for 
Did you mean: 
Lom_Labs
7 - App Architect
7 - App Architect

Hello everyone!  I have created a new scripting extension which allows you to convert formatted text in your rich text fields into markdown! 

The extension will look through all the records in the table you have selected and convert the selected field's text into markdown so that you can use it for your email, Slack, etc automations

Please feel free to reach out to me if you have any questions or feedback!

Base with extension installed

Screen Recording 2023-03-22 at 2.17.26 PM.gif

Installation instructions:
1. Click "Extension" at the top right
2. Click "Add Extension"
3. Click the "Scripting" extension
4. Click "Add Extension"
5. Paste the code below in!

Installation.gif

 

let settings = input.config({
    title: `Convert rich text field to markdown`,
    items: [
        input.config.table("table", { label: `Table` }),
        input.config.field("richTextField", { parentTable: `table`, label: `Rich text field` }),
        input.config.field("markdownField", { parentTable: `table`, label: `Output field` }),
    ],
});

let { table, richTextField, markdownField } = settings;
let query = await table.selectRecordsAsync()
let updates = new Array

query.records.forEach((record) => {
    updates.push({
        id: record.id,
        fields:{
            [markdownField.name]: record.getCellValue(richTextField.name)
        }
    })
});

while (updates.length > 0) {
    await table.updateRecordsAsync(updates.slice(0, 50));
    updates = updates.slice(50);
}

 

 

2 Replies 2

Looks like you are having fun writing scripts! 

I noticed that your screen shot shows a single line text field for your output field. I recommend using a long text field without rich text formatting as the output field. Single line text fields are not designed to have multiple lines of text, which markdown often has.

You are right!  I have updated the base so that it uses a long text field for the output field now 

Thank you 😀