Issue with Notes Field Formatting When Sending Data via API

Hi all,

TLDR: When I export markdown fields (after a user edits this via a notes component) from Glide via the API, the Markdown content gets random extra spaces and line breaks—even though it looks fine in the app. This is causing formatting issues in my Webflow CMS, and I currently have to use OpenAI to clean it up. Is there a way to prevent this, or is anyone else seeing the same problem?

I’m running into a formatting issue when using the Notes field in Glide, and I’m hoping someone has a solution or workaround.

What’s happening:

  • I let users edit rich text via the Notes field in Glide.
  • When I send that data to my Webflow CMS using the API, the formatting in the Notes field ends up with random extra spaces and line breaks.

Example of what I get from the API:

    "8mxKW": "*   Trail Run 5K and 10K on June 29, $65 entry, age 20+\n    \n*   Disc Golf 27-hole on June 28, 8:00 AM start, $50 entry, age 20+\n    \n*   Walking Soccer Tournament 6v6 on June 28, 10:00 AM start, $40 entry, Women 40+, Men 50+\n    \n*   Squash Tournament on June 28, $50 + HST entry\n    \n*   3v3 Basketball on July 6, $65 entry, men 20+, 35+; women 20+\n    \n*   Pickleball Tournament June 27-29, 8:00 AM daily, $70 + $15/category, age 30+, 50+, 60+\n    \n*   Olympic-style Athletes Village with music, food, entertainment, obstacle courses, and family fun zone\n    \n*   Full-size Olympic-caliber beach volleyball court showcasing former Olympians and professionals",
    "IAKYT": "- Trail Run 5K and 10K courses on June 29 at University of Guelph athletic facilities\n- Trail runs are on natural terrain suitable for trail running enthusiasts\n",
  • The formatting looks totally fine in the actual Glide app—the issue only happens when I pull the content out via the API.
  • To fix it right now, I’m running the content through OpenAI to clean up the spaces and line breaks before sending it to Webflow. That works, but it’s not really sustainable or cost-effective at scale.

Is this something that could be looked at?

Thank you!

2 Likes

I actually found this script to work, in case any wants to reuse it.

function cleanMarkdown(text) {
  // Split into lines, trim each line, and remove empty lines
  let lines = text
    .split('\n')
    .map(line => line.trim())           // Trim each line
    .filter(line => line.length > 0);   // Remove completely empty lines

  // Optionally: remove extra spaces after bullet points (for "*   " or "-   ")
  lines = lines.map(line => line.replace(/^([*-])\s+/, '$1 '));

  // Join back together with a single line break
  return lines.join('\n');
}

// Example usage:
let dirtyText = `
*   Trail Run 5K and 10K on June 29, $65 entry, age 20+
    
*   Disc Golf 27-hole on June 28, 8:00 AM start, $50 entry, age 20+
    
`;
let cleanedText = cleanMarkdown(dirtyText);
console.log(cleanedText);
2 Likes

I found that putting the rich text output from the notes component through a JSON object column or maybe even a JSON template column automatically cleans up the rich text.

For me I did it cause I was getting API errors when sending the rich text through the API but this might also apply for you

2 Likes